File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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="" xmlns:xsd="" xmlns:xsi=""><soapenv:Body><ns1:Transmission soapenv:encodingStyle="" 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.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:
Best wishes!
I agree. Here's the link:
subject: <ns1:arg0> in SOAP message
It's not a secret anymore!