|
I need help and direction from the gurus.
I am trying to build a webservice that is generic enough to accept ANY XML document, and return ANY XML document, so that it can be reused over and over again for several intranet components. I know I am losing schema vals etc coming with the SOAP layers by using anyType. See the attached WSDL.
Although I can see the message come in over the wire faithfully, when I try to print the SOAP Body (which will be the parameter in the Impl class method), I get null. ( The line : System.out.println ("SOAP BODY : " + processMessageDocument) ;). The hardcoded XML response comes out nice.
I am confused why this would happen. I should be able to extract data directly from the parameters.
I also do not understand as to why in a document style web service, XML SPY is spitting out the method name in the SOAP message. I tried removing processMessage from the input, I get a 500 error. So it is required. But I do not understand why.
Any help will be truly appreciated.
My Impl code : ============= package org.openuri.www;
import java.io.* ; import java.rmi.* ; import java.util.* ;
import org.w3c.dom.*; import org.xml.sax.*; import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import javax.xml.soap.* ;
import org.apache.axis.MessageContext ;
public class BlobSoapImpl implements org.openuri.www.BlobSoap { public java.lang.Object processMessage(java.lang.Object processMessageDocument) throws java.rmi.RemoteException { try { ByteArrayOutputStream ostr = new ByteArrayOutputStream() ;
MessageContext msgContext = MessageContext.getCurrentContext();
SOAPMessage soapMsg = msgContext.getMessage() ; soapMsg.writeTo (ostr) ; System.out.println ("SOAP MESSAGE ON THE WIRE : \n" + ostr.toString()) ;
System.out.println ("SOAP BODY : " + processMessageDocument) ;
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setValidating(false);
DocumentBuilder domBuilder = domFactory.newDocumentBuilder () ;
Document document = domBuilder.parse (new File ("/u/sguha/blob/client/SOAPRSP")) ;
return document ; } catch (Exception e) { e.printStackTrace() ; }
return null ; } } Input data, from SPY : <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <m:processMessage xmlns:m="http://www.openuri.org/"> <m:document><ABC>abc</ABC></m:document> </m:processMessage> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|
BlobContract.wsdl
Description: Binary data
