Title: RE: How to pass Element argument

I see. I put then like this.

   <isd:mappings>

      <isd:map encodingStyle="http://xml.apache.org/xml-soap/literalxml"

                        xmlns:x="" qname="x:orderReq"

                        javaType="org.w3c.dom.Element"

                     java2XMLClassName="org.apache.soap.encoding.literalxml.XMLParameterSerializer"

xml2JavaClassName="org.apache.soap.encoding.literalxml.XMLParameterSerializer" />

    </isd:mappings>


But I still got the error:

java.lang.IllegalArgumentException: I only know how to serialize an 'org.w3c.dom.Element'.

Do I have to put something like this in client:

        SOAPMappingRegistry smr = new SOAPMappingRegistry ();

        XMIParameterSerializer xps = new XMIParameterSerializer ();

        smr.mapTypes (Constants.NS_URI_LITERAL_XML,

                  new QName ("", "orderReq"), null, null, xps);

        // Build the Call object

        Call call = new Call();

        call.setTargetObjectURI("urn:aspentech-aebrs-api");

        call.setMethodName("createOrder");

        call.setSOAPMappingRegistry(smr);

        call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);


Yong

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 15, 2002 9:52 AM
To: [EMAIL PROTECTED]
Subject: RE: How to pass Element argument


This value should be arbitrary, you can define it in whatever way you are

setting up your namespaces.

Bryan



                                                                                                                                 

              Yong Miao                                                                                                          

              <[EMAIL PROTECTED]         To:      "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]e.org>                  

              >                                cc:      "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>                    

                                               Subject: RE: How to pass Element argument                                         

              05/15/2002 12:41 PM                                                                                                

              Please respond to                                                                                                  

              soap-user                                                                                                          

                                                                                                                                 

                                                                                                                                 



Bryan,


Thanks a lot. I am not sure what should I use for  "urn:Sample" and qname

="x:sample-element". Could you please help me out?


"urn:???


qname="x:orderReq"


   <isd:mappings>


      <isd:map encodingStyle="http://xml.apache.org/xml-soap/literalxml"


xmlns:x="urn:???" qname="x:orderReq" javaType


="org.w3c.dom.Element" java2XMLClassName


="org.apache.soap.encoding.literalxml.XMLParameterSerializer"


xml2JavaClassName


="org.apache.soap.encoding.literalxml.XMLParameterSerializer" />


    </isd:mappings>


Regards,


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


Yong Miao


[EMAIL PROTECTED]


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


-----Original Message-----

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

Sent: Wednesday, May 15, 2002 9:31 AM

To: [EMAIL PROTECTED]

Subject: RE: How to pass Element argument





For a quick look, it appears your Deployment Descriptor is missing the


following mapping:


<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"


             id="urn:test-service">


  <isd:provider type="java"


                scope="Application"


                methods="createOrder"


  >


    <isd:java class="TestService" static="false" />


  </isd:provider>





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


   <isd:mappings>


      <isd:map encodingStyle="http://xml.apache.org/xml-soap/literalxml"


xmlns:x="urn:Sample" qname="x:sample-element" javaType


="org.w3c.dom.Element" java2XMLClassName


="org.apache.soap.encoding.literalxml.XMLParameterSerializer"


xml2JavaClassName


="org.apache.soap.encoding.literalxml.XMLParameterSerializer" />


    </isd:mappings>


</isd:service>


Let me know if this helps. Thanks.


Bryan









              Yong Miao


              <[EMAIL PROTECTED]         To:

"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>


              >                                cc:

"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>


                                               Subject: RE: How to pass

Element argument


              05/15/2002 12:17 PM


              Please respond to


              soap-user










What's wrong?





Service descriptor:


<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"


             id="urn:test-service">


  <isd:provider type="java"


                scope="Application"


                methods="createOrder"


  >


    <isd:java class="TestService" static="false" />


  </isd:provider>





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


</isd:service>


Here's the service look like:


    public String createOrder(Element orderReq)


    {


      // check input params


      if( orderReq == null)


      {


        throw new IllegalArgumentException("The orderReq cannot be null.");


      }


      // process order


      boolean ret = processor.process(orderReq);


      if(ret)


        return "1";


      else


        return "0";


    }


Here's the client calling the service:


        DocumentBuilder builder = XMLParserUtils.getXMLDocBuilder();


        Document doc = builder.parse(new FileInputStream(xmlFile));


        // Build the Call object


        Call call = new Call();


        call.setTargetObjectURI("urn:test-service");


        call.setMethodName("createOrder");


        call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);


        // Set up parameters


        Vector params = new Vector();


        params.addElement(new Parameter("orderReq", Element.class,


doc.getDocumentElement(), Constants.NS_URI_LITERAL_XML));


        call.setParams(params);


        // Invoke the call


        Response response;


        response = call.invoke(url, "");





Regards,


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


Yong Miao


Aspentech Bothell


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


      -----Original Message-----


      From: Miguel Perez [mailto:[EMAIL PROTECTED]]


      Sent: Wednesday, May 15, 2002 9:10 AM


      To: '[EMAIL PROTECTED]'


      Subject: RE: How to pass Element argument


      What does your code look like? It appears that you are trying to pass


      something other than an Element type to your service?


      Miguel


            -----Original Message-----


            From: Yong Miao [mailto:[EMAIL PROTECTED]]


            Sent: Wednesday, May 15, 2002 11:07 AM


            To: '[EMAIL PROTECTED]'


            Cc: '[EMAIL PROTECTED]'


            Subject: RE: How to pass Element argument


            Miguel,


            Thanks for the reply. I still got error like:


            java.lang.IllegalArgumentException: I only know how to


            serialize an 'org.w3c.dom.Element'.


            [SOAPException: faultCode=SOAP-ENV:Server;


            msg=java.lang.IllegalArgumentException: I only know how to


            serialize an 'org.w3c.dom.Element'.]


            I wonder if there's something to do with the service mapping. I


            am not sure what and how to do.


            Something like XMLParameterSerializer.





            Regards,


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


            Yong Miao


            [EMAIL PROTECTED]





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


                  -----Original Message-----


                  From: Miguel Perez [mailto:[EMAIL PROTECTED]]


                  Sent: Wednesday, May 15, 2002 8:57 AM


                  To: '[EMAIL PROTECTED]'


                  Subject: RE: How to pass Element argument


                    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);


                   Element inputNode = tempDocument.createElement


                  ("InputParams");


                   inputNode.setAttribute("partnerName",partnerName);


                    params = new java.util.Vector();


                    params.addElement(new Parameter



("productinformation",Element.class,inputNode,Constants.NS_URI_LITERAL_XML));


                        -----Original Message-----


                        From: Yong Miao [mailto:[EMAIL PROTECTED]]


                        Sent: Wednesday, May 15, 2002 10:48 AM


                        To: [EMAIL PROTECTED]


                        Subject: How to pass Element argument





                        Hi,





                        I have a service that requires DOM Element as


                        input. There's no mapping for the service.





                        How should I a DOM Element variable to the service


                        from client?





                        I got errors like this:





                        [SOAPException: faultCode=SOAP-ENV:Client; msg=No


                        Serializer found to serialize a


                        'org.w3c.dom.Element' using encoding style '


                        http://schemas.xmlsoap.org/soap/encoding/'.;


                        targetException=java.lang.IllegalArgumentException:


                        No Serializer found to serialize a


                        'org.w3c.dom.Element' using encoding style '


                        http://schemas.xmlsoap.org/soap/encoding/'.]





                                at



org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:324)





                                at


                        org.apache.soap.rpc.Call.invoke(Call.java:205)





                                at


                        OrderClient.placeOrder(OrderClient.java:44)





                                at OrderClient.main(OrderClient.java:83)





                        Thanks,





                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





                        Yong Miao





                        [EMAIL PROTECTED]





                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~









This message is for the designated recipient only and may contain


privileged, proprietary, or otherwise private information.  If you have


received it in error, please notify the sender immediately and delete the


original.  Any other use of the email by you is prohibited.






This message is for the designated recipient only and may contain

privileged, proprietary, or otherwise private information.  If you have

received it in error, please notify the sender immediately and delete the

original.  Any other use of the email by you is prohibited.

Reply via email to