• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<ns1:arg0> in SOAP message

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 = "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.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic