Hi,

I am trying to invoke a web service using axis client. I have written a java
client program making use of the class org.apache.axis.client.Call. Based on
that I could sent the request to my web service.

This is the request I got:

<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:addRecord xmlns:ns1=http://localhost:8888/ops/ws/test

       soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>

           <logDate
xsi:type="xsd:string">2002-10-10T12:00:00-05:00</logDate>

           <name xsi:type="xsd:string">Hello20</name>

       </ns1:addRecord>

   </soapenv:Body>

</soapenv:Envelope>
Here <logDate> and <name> are my parameter tags. I want to embed this inside
a root tag named <devTest>.

I need to embed this whole data part inside a tag containing the operation
name addRecord.

This is my Java code:

 String retL = "";
 try{
  String endPoint = "http://localhost:8888/ops/ws/test";;
  String operation = "addRecord";

  QName qOperation = new QName(endPoint, operation);
  QName qTest = new QName( "", "devTest" );

  URL urlPoint = new URL(endPoint);
  Object objArgs[] = new Object[] {"2002-10-10T12:00:00-05:00","Hello20"};
  Service service = new Service();
  Call call = (Call) service.createCall();
  call.setTargetEndpointAddress(urlPoint);
  call.setOperationName(qOperation);
  call.addParameter( "logDate", qTest, ParameterMode.IN );
  call.addParameter( "name", qTest, ParameterMode.IN );
  call.setReturnType (XMLType.XSD_STRING);
  retL=(String) call.invoke(objArgs);

 }catch (MalformedURLException e) {
  e.printStackTrace();
 } catch (RemoteException e) {
  e.printStackTrace();
 } catch (ServiceException e) {
  e.printStackTrace();
 }
 return retL;

This results in adding both the tags <logDate> and <name> under <addRecord>
which is the operation name.

But I need to add another root tag at a level above these two parameters so
that my request looks like this:

<addRecord>

   <devTest>

       <logDate>...</logDate>

       <name>...</name>

   </devTest>

</addRecord>
How can I achieve this through my axis client call?

Again, I have to use wrapped document literal style. What are the
modifications I have to make in my Java program to do this?

How can I avoid xsd: in my request?

Thanks & Regards
Merin

Reply via email to