jQuery in Action, 3rd edition
The moose likes Web Services and the fly likes <ns1:arg0> in SOAP message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "<ns1:arg0> in SOAP message" Watch "<ns1:arg0> in SOAP message" New topic

<ns1:arg0> in SOAP message

Mike Pickard

Joined: Feb 22, 2009
Posts: 3
I am having trouble creating properly formatted XML in my SOAP message. As you can see, my generated SOAP message contains an <ns1:arg0>

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:Transmission soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://some.url"><ns1:arg0><ns1:TransmissionHeader><ns1:Username>SOME_USERNAME</ns1:Username><ns1:Password>SOME_PASSWORD</ns1:Password></ns1:TransmissionHeader></ns1:arg0></ns1:Transmission></soapenv:Body></soapenv:Envelope>

The problem is, this declaration breaks the structure of my XML, which needs to look something like:

<Transmission xmlns:ns1="http://some.url"><ns1:TransmissionHeader><ns1:Username>SOME_USERNAME</ns1:Username><ns1:Password>SOME_PASSWORD</ns1:Password></ns1:TransmissionHeader></Transmission>

Here is a code snippet:

String endpoint = "";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://some.url", "Transmission"));

//call.addParameter("ns1:TransmissionHeader", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
Object ack = (Object) call.invoke(new Object[] { "<ns1:TransmissionHeader><ns1:username>SOME_USERNAME</ns1:username><ns1:password>SOME_PASSWORD</ns1:password></ns1:TransmissionHeader>" });

If anyone can help steer me to a solution, that would be very much appreciated.
Thanks in advance.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
The problem that you encounter is caused by you not using the API correctly. Take a look at this webpage, which contains an example on how to do dynamic invocation of a JAX_RPC web service: http://www.ibm.com/developerworks/webservices/library/ws-javaclient/index.html
Best wishes!
I agree. Here's the link: http://aspose.com/file-tools
subject: <ns1:arg0> in SOAP message
It's not a secret anymore!