Hi All,
 
I am new to Axis. I have a simple SOAP service which returns a datahandler.
 
I also want to return another paramater such as filesize or filename in my message body. What is a good way to do this? Does anyone have any code examples? I am using Axis 1.1.
 
Basically I want the body to contain
<myparameter> myvalue <myparameter>
 
Below is my client and service.
 
Client:
  call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
  call.setOperationName( new QName("urn:dhService", "myMethod") );
  call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN);
  QName qnameAttachment = new QName("urn:dhService", "DataHandler");
  call.registerTypeMapping(javax.activation.DataHandler.class,
                  qnameAttachment,
                   JAFDataHandlerSerializerFactory.class,
                   JAFDataHandlerDeserializerFactory.class);
   call.setReturnType(qnameAttachment);
   DataHandler ret = (DataHandler) call.invoke( new Object [] { textToSend } );
 
Service:
public DataHandler myMethod(String arg)
{
   try {
     URL url = "" URL("file:///myfile.txt");
     DataHandler dh = new DataHandler(url);
     return dh;
     ...
 
This produces the following XML response:
 
HTTP/1.1 200 OK
Content-Type: multipart/related; type="text/xml"; start="<8740D307B85F91BD06BF53BA1D26550C>";  boundary="----=_Part_2_15198443.1101775257325"
Date: Tue, 30 Nov 2004 00:40:57 GMT
Server: Apache-Coyote/1.1
Connection: close
 
 
------=_Part_2_15198443.1101775257325
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <8740D307B85F91BD06BF53BA1D26550C>
 
<?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:myMethodResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:dhService">
   <ns1:myMethodReturn href="" xmlns:ns2="http://xml.apache.org/xml-soap"/>
  </ns1:myMethodResponse>
 </soapenv:Body>
</soapenv:Envelope>
------=_Part_2_15198443.1101775257325
Content-Type: text/plain
Content-Transfer-Encoding: binary
Content-Id: <3B3512781AF5D97113F0079CBF087495>
 
...blah...
 
------=_Part_2_15198443.1101775257325--
 
Thanks for your help in advance.


Do you Yahoo!?
The all-new My Yahoo! – Get yours free!

Reply via email to