You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Hecking, Dirck J" <Di...@rsco.com> on 2001/06/15 20:54:37 UTC

User defined object as a request, literal XML as a response. Poss ible?!

Guys,

Dirck here again. I have read several mails regarding this issue. I have not
seen one that illustrates my exact problem. The key here is that I want to
recieve literal xml in my response but want to supply a user defined object
as the requesting parameter. This code actually executes the service fine
and reads the arguements out of my object. The
response gets lost though, even though I specified literal xml encoding as
the default encoding for my document. My Apache Soap Service running on
Weblogic 5.1 has the following characteristics:

Note: The following code is a snippet.

Server:
public Element getResearch(ResearchArguments args)
{
      DocumentBuilderFactory  dbf     =
DocumentBuilderFactory.newInstance();
      DocumentBuilder         xdb     = dbf.newDocumentBuilder ();
      Document                doc     = xdb.newDocument ();

       Element researchElement = doc.createElement("Whatever");

 // Extracts fields from the ResearchArguments class and creates a
 dynamic
 // research elements based on the information.

 return researchElement;
 }

 Client:
 public Element sendRequest()
 {
       url     =   new URL(routerUrl);

 ResearchArguments   args    = new
 ResearchArguments("data1","data2","data3");

       SOAPMappingRegistry smr     = new SOAPMappingRegistry();
       BeanSerializer      beanSer = new BeanSerializer();

 smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
 QName("urn:xml-soap-args-demo", "args") , ResearchArguments.class,
beanSer,
 beanSer);

       call.setTargetObjectURI("urn:" + service);
       call.setMethodName(method);
       call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);

       call.setSOAPMappingRegistry(smr);

       params.addElement(new Parameter("args",
 ResearchArguments.class,
 args,
 Constants.NS_URI_SOAP_ENC));

 call.setParams(params);

 resp = call.invoke(url, "");
 // A fault gets generated from the server after this line
 }

 Exception:
 Generated fault:
   Fault Code   = SOAP-ENV:Server
   Fault String = java.lang.IllegalArgumentException: No Serializer found
to
 serialize a 'org.w3c.dom.Element' using encoding style
 'http://schemas.xmlsoap.org/soap/encoding/'.

 Deployment Descriptor:
 <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
              id="urn:HQService">
 <isd:provider type="java"
                       scope="Application"
                       methods="getResearch">
     <isd:java class="rs.ecommerce.service.providers.HQService"
 static="false"/>
 </isd:provider>


<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListene
 r>

         <isd:mappings>
 <isd:map
 encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                          xmlns:x="urn:xml-soap-args-demo" qname="x:args"

 javaType="rs.ecommerce.service.xmlobjects.ResearchArguments"

 java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"

 xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
 </isd:mappings>
 </isd:service>






------------------------------------------------------------------------------
DISCLAIMER

Notice Regarding Entry of Orders and Instructions:  

Please do not transmit orders and/or instructions regarding your Robertson Stephens account(s) by e-mail. Orders and/or instructions transmitted by e-mail will not be accepted by Robertson Stephens, and Robertson Stephens will not be responsible for carrying out such orders and/or instructions.

Notice Regarding Privacy and Confidentiality:  

Robertson Stephens reserves the right to monitor and review the content of all e-mail communications sent and/or received by its employees.


------------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org