• Post Reply Bookmark Topic Watch Topic
  • New Topic

<ns1:arg0> in SOAP message  RSS feed

Mike Pickard
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!