You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Prateek Asthana <pa...@gmail.com> on 2010/06/01 04:08:42 UTC

passing arrays using AXIS2

Hi,
This question is regarding passing String arrays from client to server
using Axis2. I have gone through several forums for this and I have a
few pointers which says to use Arrays instead of ArrayList. I am
adopting the contract first approach. Can someone please post a sample
WSDL to resolve this issue. I plan to generate the code using
wsdl2java scripts.

Thanks,
Prateek

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: InOnly client code?

Posted by William Walsh <WW...@curamsoftware.com>.
Hi Deepal,  That runs if I change the end point port to match 6060.  But, where should I look for the output "I am here" to show up?  I can see the SOAP message in TCPMON; but, don't know if the request gets to the server.  

But since I'm doing this on WebSphere with EJB code I'm not sure how much that will help.  This essentially looks like the difference in the SOAP/trace; first (soapui) works, second (POJO) doesn't: 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rem="http://remote.testmodel.util.curam">
   <soap:Header/>
   <soap:Body>
      <rem:testCredentialsInOnlyOverride>
         <!--Optional:-->
         <rem:testCredentialsInOnlyOverride>zzzxxx</rem:testCredentialsInOnlyOverride>
      </rem:testCredentialsInOnlyOverride>
   </soap:Body>
</soap:Envelope> 
 [DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006965674] Invoking Handler 'MustUnderstandChecker' in Phase 'OperationInPhase'
 [DEBUG] Building list of understood headers for all operations under CustomReceiverTestCredentials
 [DEBUG] Parameter not on CustomReceiverTestCredentials; org.apache.axis2.jaxws.description.EndpointDescription.handlerParameterQNames
 [DEBUG] Adding headers from SOAP handlers; headers = null
 [DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006965674] Checking post-conditions for phase "OperationInPhase"
 [DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006965674] Checking pre-condition for Phase "soapmonitorPhase"
 [DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006965674] Invoking phase "soapmonitorPhase"
 [DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006965674] Invoking Handler 'null' in Phase 'soapmonitorPhase'
 [DEBUG] XMLStreamWriter is com.ctc.wstx.sw.SimpleNsStreamWriter
 [DEBUG] Build the OMElement testCredentialsInOnlyOverride by the StaxSOAPModelBuilder
 [DEBUG] Build the OMElement testCredentialsInOnlyOverride by the StaxSOAPModelBuilder
 [DEBUG] Calling MTOMXMLStreamWriter.flush
 [DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006965674] Checking post-conditions for phase "soapmonitorPhase"
 [DEBUG] webservice.CustomReceiverInOnlyOverrideCredentials.getAxis2Credentials() is overriding Curam default implementation.
 [DEBUG] MessageDoAs.createLoginContext()

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body><soap:Envelope xmlns:soap="http://remote.testmodel.util.curam" xmlns:rem="http://remote.testmodel.util.curam">
 <soap:Header />
  <soap:Body>
    <rem:testCredentialsInOnlyOverride>String set by call from testCustomInOnlyMessageReceiver</rem:testCredentialsInOnlyOverride>
  </soap:Body>
</soap:Envelope></soapenv:Body></soapenv:Envelope>
[DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006902588] Invoking Handler 'MustUnderstandChecker' in Phase 'OperationInPhase'
[DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006902588] Checking post-conditions for phase "OperationInPhase"
[DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006902588] Checking pre-condition for Phase "soapmonitorPhase"
[DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006902588] Invoking phase "soapmonitorPhase"
[DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006902588] Invoking Handler 'null' in Phase 'soapmonitorPhase'
[DEBUG] XMLStreamWriter is com.ctc.wstx.sw.SimpleNsStreamWriter
[DEBUG] Build the OMElement Envelope by the StaxSOAPModelBuilder
[DEBUG] Build the OMElement Header by the StaxSOAPModelBuilder
[DEBUG] Build the OMElement Body by the StaxSOAPModelBuilder
[DEBUG] Build the OMElement testCredentialsInOnlyOverride by the StaxSOAPModelBuilder
[DEBUG] Calling MTOMXMLStreamWriter.flush
[DEBUG] [MessageContext: logID=urn:uuid:C3431AC2FD01B41C7D1276006902588] Checking post-conditions for phase "soapmonitorPhase"
[DEBUG] webservice.CustomReceiverInOnlyOverrideCredentials.getAxis2Credentials() is overriding Curam default implementation.
[DEBUG] MessageDoAs.createLoginContext()

Thanks,
William


-----Original Message-----
From: Deepal jayasinghe [mailto:deepalk@gmail.com] 
Sent: Friday, June 04, 2010 3:54 PM
To: java-user@axis.apache.org
Subject: Re: InOnly client code?

Try the following;

First run the EchoServer, that will start a simple Axis2 server on port
6060. Then run the client. If the code does not work for you let me know.


import org.apache.axis2.engine.AxisServer;

======================EchoServer============================

public class EchoServer {
    public static void main(String[] args) throws Exception {
        new AxisServer().deployService(EchoService.class.getName());
    }
}
====================EchoService==============================
public class EchoService {

    public void echo(String value){
        System.out.println("I am here");
        //return value;
    }
}
=====================EchoClient=================================
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;

public class EchoClient {
    public static void main(String[] args) throws Exception {
        ServiceClient client = new ServiceClient();
        Options opts = new Options();
        opts.setTo(new
EndpointReference("http://localhost:8000/axis2/services/EchoService"));
        opts.setAction("urn:echo");
        opts.setUseSeparateListener(true);
        client.setOptions(opts);
        client.fireAndForget(createPayLoad());
        Thread.sleep(500);
    }

    public static OMElement createPayLoad() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://sample.org", "ns");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("value", omNs);
        method.addChild(value);
        value.setText("Axis2");
        return method;

    }
}
> Deepal,  Thanks for the feedback.  I have my sleep set to 30000 (should be enough) and have blocked it in Eclipse too.  Have also tried sendRobust().  Any other ideas? 
>
> William
>
>
> -----Original Message-----
> From: Deepal jayasinghe [mailto:deepalk@gmail.com] 
> Sent: Thursday, June 03, 2010 6:43 PM
> To: java-user@axis.apache.org
> Subject: Re: InOnly client code?
>
> Hi William,
>
> When you invoke the service using fireAndForget you need to put put a
> sleep statement after invocation, if you do not do that the main thread
> terminate before sending  the message.
>   
>> Has anyone had success writing an In-Only client that they'd be willing to share?  I've deployed a simple In-Only service on WebSphere that works fine via soapui, but when I try to invoke it via a Java client it doesn't run, completely.  That is, I can see the log4j trace with additional activity after the usual ending "Exiting deleteAttachments()" entry. I know it doesn't completely run (which I know sounds strange) because I have another service for interrogating the static variable it initializes.   Using tcpmon I'm not seeing any significant difference in the SOAP messages, which I've constructed "manually" or via Axiom APIs based on what I see soapui sending.  I've tried using fireAndForget and robustSend along with stub invocation (equivalent of the Axis2 generated test case), the latter fails with AxisFault: The input stream for an incoming message is null.
>>
>> Thanks,
>> William
>>
>>
>>
>>
>> The information in this email is confidential and may be legally privileged.
>> It is intended solely for the addressee. Access to this email by anyone else
>> is unauthorized. If you are not the intended recipient, any disclosure,
>> copying, distribution or any action taken or omitted to be taken in reliance
>> on it, is prohibited and may be unlawful. If you are not the intended
>> addressee please contact the sender and dispose of this e-mail. Thank you.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>>
>>   
>>     
>
>
>   


-- 
"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein


http://blogs.deepal.org
http://deepal.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org



The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: InOnly client code?

Posted by Deepal jayasinghe <de...@gmail.com>.
Try the following;

First run the EchoServer, that will start a simple Axis2 server on port
6060. Then run the client. If the code does not work for you let me know.


import org.apache.axis2.engine.AxisServer;

======================EchoServer============================

public class EchoServer {
    public static void main(String[] args) throws Exception {
        new AxisServer().deployService(EchoService.class.getName());
    }
}
====================EchoService==============================
public class EchoService {

    public void echo(String value){
        System.out.println("I am here");
        //return value;
    }
}
=====================EchoClient=================================
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;

public class EchoClient {
    public static void main(String[] args) throws Exception {
        ServiceClient client = new ServiceClient();
        Options opts = new Options();
        opts.setTo(new
EndpointReference("http://localhost:8000/axis2/services/EchoService"));
        opts.setAction("urn:echo");
        opts.setUseSeparateListener(true);
        client.setOptions(opts);
        client.fireAndForget(createPayLoad());
        Thread.sleep(500);
    }

    public static OMElement createPayLoad() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://sample.org", "ns");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("value", omNs);
        method.addChild(value);
        value.setText("Axis2");
        return method;

    }
}
> Deepal,  Thanks for the feedback.  I have my sleep set to 30000 (should be enough) and have blocked it in Eclipse too.  Have also tried sendRobust().  Any other ideas? 
>
> William
>
>
> -----Original Message-----
> From: Deepal jayasinghe [mailto:deepalk@gmail.com] 
> Sent: Thursday, June 03, 2010 6:43 PM
> To: java-user@axis.apache.org
> Subject: Re: InOnly client code?
>
> Hi William,
>
> When you invoke the service using fireAndForget you need to put put a
> sleep statement after invocation, if you do not do that the main thread
> terminate before sending  the message.
>   
>> Has anyone had success writing an In-Only client that they'd be willing to share?  I've deployed a simple In-Only service on WebSphere that works fine via soapui, but when I try to invoke it via a Java client it doesn't run, completely.  That is, I can see the log4j trace with additional activity after the usual ending "Exiting deleteAttachments()" entry. I know it doesn't completely run (which I know sounds strange) because I have another service for interrogating the static variable it initializes.   Using tcpmon I'm not seeing any significant difference in the SOAP messages, which I've constructed "manually" or via Axiom APIs based on what I see soapui sending.  I've tried using fireAndForget and robustSend along with stub invocation (equivalent of the Axis2 generated test case), the latter fails with AxisFault: The input stream for an incoming message is null.
>>
>> Thanks,
>> William
>>
>>
>>
>>
>> The information in this email is confidential and may be legally privileged.
>> It is intended solely for the addressee. Access to this email by anyone else
>> is unauthorized. If you are not the intended recipient, any disclosure,
>> copying, distribution or any action taken or omitted to be taken in reliance
>> on it, is prohibited and may be unlawful. If you are not the intended
>> addressee please contact the sender and dispose of this e-mail. Thank you.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-user-help@axis.apache.org
>>
>>
>>   
>>     
>
>
>   


-- 
"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein


http://blogs.deepal.org
http://deepal.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: InOnly client code?

Posted by William Walsh <WW...@curamsoftware.com>.
Deepal,  Thanks for the feedback.  I have my sleep set to 30000 (should be enough) and have blocked it in Eclipse too.  Have also tried sendRobust().  Any other ideas? 

William


-----Original Message-----
From: Deepal jayasinghe [mailto:deepalk@gmail.com] 
Sent: Thursday, June 03, 2010 6:43 PM
To: java-user@axis.apache.org
Subject: Re: InOnly client code?

Hi William,

When you invoke the service using fireAndForget you need to put put a
sleep statement after invocation, if you do not do that the main thread
terminate before sending  the message.
> Has anyone had success writing an In-Only client that they'd be willing to share?  I've deployed a simple In-Only service on WebSphere that works fine via soapui, but when I try to invoke it via a Java client it doesn't run, completely.  That is, I can see the log4j trace with additional activity after the usual ending "Exiting deleteAttachments()" entry. I know it doesn't completely run (which I know sounds strange) because I have another service for interrogating the static variable it initializes.   Using tcpmon I'm not seeing any significant difference in the SOAP messages, which I've constructed "manually" or via Axiom APIs based on what I see soapui sending.  I've tried using fireAndForget and robustSend along with stub invocation (equivalent of the Axis2 generated test case), the latter fails with AxisFault: The input stream for an incoming message is null.
>
> Thanks,
> William
>
>
>
>
> The information in this email is confidential and may be legally privileged.
> It is intended solely for the addressee. Access to this email by anyone else
> is unauthorized. If you are not the intended recipient, any disclosure,
> copying, distribution or any action taken or omitted to be taken in reliance
> on it, is prohibited and may be unlawful. If you are not the intended
> addressee please contact the sender and dispose of this e-mail. Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
>   


-- 
"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein


http://blogs.deepal.org
http://deepal.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org



The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: InOnly client code?

Posted by Deepal jayasinghe <de...@gmail.com>.
Hi William,

When you invoke the service using fireAndForget you need to put put a
sleep statement after invocation, if you do not do that the main thread
terminate before sending  the message.
> Has anyone had success writing an In-Only client that they'd be willing to share?  I've deployed a simple In-Only service on WebSphere that works fine via soapui, but when I try to invoke it via a Java client it doesn't run, completely.  That is, I can see the log4j trace with additional activity after the usual ending "Exiting deleteAttachments()" entry. I know it doesn't completely run (which I know sounds strange) because I have another service for interrogating the static variable it initializes.   Using tcpmon I'm not seeing any significant difference in the SOAP messages, which I've constructed "manually" or via Axiom APIs based on what I see soapui sending.  I've tried using fireAndForget and robustSend along with stub invocation (equivalent of the Axis2 generated test case), the latter fails with AxisFault: The input stream for an incoming message is null.
>
> Thanks,
> William
>
>
>
>
> The information in this email is confidential and may be legally privileged.
> It is intended solely for the addressee. Access to this email by anyone else
> is unauthorized. If you are not the intended recipient, any disclosure,
> copying, distribution or any action taken or omitted to be taken in reliance
> on it, is prohibited and may be unlawful. If you are not the intended
> addressee please contact the sender and dispose of this e-mail. Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>
>   


-- 
"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein


http://blogs.deepal.org
http://deepal.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


InOnly client code?

Posted by William Walsh <WW...@curamsoftware.com>.
Has anyone had success writing an In-Only client that they'd be willing to share?  I've deployed a simple In-Only service on WebSphere that works fine via soapui, but when I try to invoke it via a Java client it doesn't run, completely.  That is, I can see the log4j trace with additional activity after the usual ending "Exiting deleteAttachments()" entry. I know it doesn't completely run (which I know sounds strange) because I have another service for interrogating the static variable it initializes.   Using tcpmon I'm not seeing any significant difference in the SOAP messages, which I've constructed "manually" or via Axiom APIs based on what I see soapui sending.  I've tried using fireAndForget and robustSend along with stub invocation (equivalent of the Axis2 generated test case), the latter fails with AxisFault: The input stream for an incoming message is null.

Thanks,
William




The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org