wood burning stoves*
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
Author

<ns1:arg0> in SOAP message

Mike Pickard
Greenhorn

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 = "http://127.0.0.1:8080";
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);
//call.setReturnType(org.apache.axis.Constants.XSD_STRING);
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
    
    1
Hello!
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!
 
jQuery in Action, 2nd edition
 
subject: <ns1:arg0> in SOAP message