You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by remko de knikker <re...@yale.edu> on 2003/07/01 16:15:36 UTC

Re: Creating message-style services -> example

I had two difficulties when I was trying to create a message style 
service with other signatures than the examples:
- to create a correct wsdd for message-style services
- to create a client

The Axis call.invoke method always receives an Object type as response 
no matter what the return type of the signature is, if you write a 
client within Axis. To 'correct' this, I write:

Document doc1 = builder.newDocument();
Element root = doc1.createElementNS("biryani.med.yale.edu","requestmsg");
SOAPBodyElement s1 = new SOAPBodyElement(root);
objResp  = call.invoke(new Object[] { s1 }); // throws RemoteException
Vector vResp = (Vector) objResp;
SOAPBodyElement elemResp = (SOAPBodyElement) vResp.get(0);
Document docResp = elemResp.getAsDocument();

Note: when I use call.invoke(new Object[] { doc1 });
Axis throws
java.io.IOException: No serializer found for class 
org.apache.xerces.dom.DocumentImpl in registry 
org.apache.axis.encoding.TypeMappingImpl

In the org.apache.axis.encoding.ser package you will find a list of 
serializer, which contains an ElementSerializer but no 
DocumentSerializer. I assume this causes it, which requires you to write 
your own serializer as an alternative. I prefer to use the 
SOAPBodyElement, but haven't tested yet how it works for 
non-Axis/non-Java clients. I suspect this is the reason why the 
ELement[] and SOAPBodyElement[] weren't any problem to implement. I 
haven't gotten to writing my own Serializers yet....

On the serverside I simply write the methods as the signatures that are 
given:

public Document method1(Document doc1) throws RemoteException{return 
someDocument;}

The wsdd looks as follows:

<deployment name="GetXSLIM" xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
 
  <handler name="handlerXSLIM" type="java:ws.xslim.BasicHandler_XSLIM"/>

  <service name="GetXSLIM" style="message">
      <requestFlow>
          <handler type="handlerXSLIM"/>
      </requestFlow>
      <responseFlow>
        <handler type="handlerXSLIM"/>
    </responseFlow>
   
    <parameter name="className" value="ws.xslim.GetXSLIM" />
    <parameter name="allowedMethods" value="method1" />
    <wsdlFile>/../../files/xslim/wsdl/GetXSLIM.wsdl</wsdlFile>
    <!--parameter name="wsdlInputSchema" 
value="http://biryani.med.yale.edu:8081/axis/files/xslim/GetXSLIM_method1Request.xsd"/-->
   
  </service>

</deployment>


Balaji Thirugnanam wrote:

> try this link,
>  
> http://cass123.ast.cam.ac.uk/documents/AxisMsgParam.html
>
>     -----Original Message-----
>     From: Volkmann, Mark [mailto:Mark.Volkmann@AGEDWARDS.com]
>     Sent: Tuesday, July 01, 2003 9:00 AM
>     To: 'axis-user@ws.apache.org'
>     Subject: RE: Creating message-style services
>
>     I think the reason you've only seen examples of using the signature
>
>     public Element [] method(Element[] bodies)
>
>     is that the other three supposedly supported signatures don't work.
>     I've tried to use them without success.
>     I too would like to see working examples of using the other
>     signatures.
>
>     > -----Original Message-----
>     > From: Sachin [mailto:csachin@pisoftek.com]
>     > Sent: Tuesday, July 01, 2003 1:56 AM
>     > To: Axis userList (E-mail)
>     > Subject: Creating message-style services
>     >
>     >
>     > Hi All,
>     >         well i have posted two problem related to XML
>     > Document handling via
>     > web Services but got no response.
>     >
>     > but After some study on net and help of some users.I am able
>     > to find that
>     > for this i have to create message-style service Axis has
>     > given four methods
>     > for it
>     > public Element [] method(Element [] bodies)
>     > public SOAPBodyElement [] method (SOAPBodyElement [] bodies)
>     > public Document method(Document body)
>     > public void method(SOAPEnvelope req, SOAPEnvelope resp)
>     >
>     > but only example of public Element [] method(Element []
>     > bodies) is given so
>     > if i have to look for more example
>     > then where should i go
>     >
>     > Axis Site has very little mentioning About it so more
>     > documentation need to
>     > be provided on these topics or
>     > Anyone can suggest me about it.
>     >
>     > Thanks
>     >
>     >
>     >
>     >
>
>
>
>     ***********************************************************************************
>     WARNING: All e-mail sent to and from this address will be received or
>     otherwise recorded by the A.G. Edwards corporate e-mail system and is
>     subject to archival, monitoring or review by, and/or disclosure to,
>     someone other than the recipient.
>     ************************************************************************************
>


Re: Creating message-style services -> example

Posted by remko de knikker <re...@yale.edu>.
In addition I have to notice that in the latest release a 
DocumentSerializer is added, I need to upgrade!
r

remko de knikker wrote:

> I had two difficulties when I was trying to create a message style 
> service with other signatures than the examples:
> - to create a correct wsdd for message-style services
> - to create a client
>
> The Axis call.invoke method always receives an Object type as response 
> no matter what the return type of the signature is, if you write a 
> client within Axis. To 'correct' this, I write:
>
> Document doc1 = builder.newDocument();
> Element root = doc1.createElementNS("biryani.med.yale.edu","requestmsg");
> SOAPBodyElement s1 = new SOAPBodyElement(root);
> objResp  = call.invoke(new Object[] { s1 }); // throws RemoteException
> Vector vResp = (Vector) objResp;
> SOAPBodyElement elemResp = (SOAPBodyElement) vResp.get(0);
> Document docResp = elemResp.getAsDocument();
>
> Note: when I use call.invoke(new Object[] { doc1 });
> Axis throws
> java.io.IOException: No serializer found for class 
> org.apache.xerces.dom.DocumentImpl in registry 
> org.apache.axis.encoding.TypeMappingImpl
>
> In the org.apache.axis.encoding.ser package you will find a list of 
> serializer, which contains an ElementSerializer but no 
> DocumentSerializer. I assume this causes it, which requires you to 
> write your own serializer as an alternative. I prefer to use the 
> SOAPBodyElement, but haven't tested yet how it works for 
> non-Axis/non-Java clients. I suspect this is the reason why the 
> ELement[] and SOAPBodyElement[] weren't any problem to implement. I 
> haven't gotten to writing my own Serializers yet....
>
> On the serverside I simply write the methods as the signatures that 
> are given:
>
> public Document method1(Document doc1) throws RemoteException{return 
> someDocument;}
>
> The wsdd looks as follows:
>
> <deployment name="GetXSLIM" xmlns="http://xml.apache.org/axis/wsdd/"
>             xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
>             xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
>  
>   <handler name="handlerXSLIM" type="java:ws.xslim.BasicHandler_XSLIM"/>
>
>   <service name="GetXSLIM" style="message">
>       <requestFlow>
>           <handler type="handlerXSLIM"/>
>       </requestFlow>
>       <responseFlow>
>         <handler type="handlerXSLIM"/>
>     </responseFlow>
>    
>     <parameter name="className" value="ws.xslim.GetXSLIM" />
>     <parameter name="allowedMethods" value="method1" />
>     <wsdlFile>/../../files/xslim/wsdl/GetXSLIM.wsdl</wsdlFile>
>     <!--parameter name="wsdlInputSchema" 
> value="http://biryani.med.yale.edu:8081/axis/files/xslim/GetXSLIM_method1Request.xsd"/-->
>    
>   </service>
>
> </deployment>
>
>
> Balaji Thirugnanam wrote:
>
>> try this link,
>>  
>> http://cass123.ast.cam.ac.uk/documents/AxisMsgParam.html
>>
>>     -----Original Message-----
>>     From: Volkmann, Mark [mailto:Mark.Volkmann@AGEDWARDS.com]
>>     Sent: Tuesday, July 01, 2003 9:00 AM
>>     To: 'axis-user@ws.apache.org'
>>     Subject: RE: Creating message-style services
>>
>>     I think the reason you've only seen examples of using the signature
>>
>>     public Element [] method(Element[] bodies)
>>
>>     is that the other three supposedly supported signatures don't work.
>>     I've tried to use them without success.
>>     I too would like to see working examples of using the other
>>     signatures.
>>
>>     > -----Original Message-----
>>     > From: Sachin [mailto:csachin@pisoftek.com]
>>     > Sent: Tuesday, July 01, 2003 1:56 AM
>>     > To: Axis userList (E-mail)
>>     > Subject: Creating message-style services
>>     >
>>     >
>>     > Hi All,
>>     >         well i have posted two problem related to XML
>>     > Document handling via
>>     > web Services but got no response.
>>     >
>>     > but After some study on net and help of some users.I am able
>>     > to find that
>>     > for this i have to create message-style service Axis has
>>     > given four methods
>>     > for it
>>     > public Element [] method(Element [] bodies)
>>     > public SOAPBodyElement [] method (SOAPBodyElement [] bodies)
>>     > public Document method(Document body)
>>     > public void method(SOAPEnvelope req, SOAPEnvelope resp)
>>     >
>>     > but only example of public Element [] method(Element []
>>     > bodies) is given so
>>     > if i have to look for more example
>>     > then where should i go
>>     >
>>     > Axis Site has very little mentioning About it so more
>>     > documentation need to
>>     > be provided on these topics or
>>     > Anyone can suggest me about it.
>>     >
>>     > Thanks
>>     >
>>     >
>>     >
>>     >
>>
>>
>>
>>     ***********************************************************************************
>>     WARNING: All e-mail sent to and from this address will be received or
>>     otherwise recorded by the A.G. Edwards corporate e-mail system and is
>>     subject to archival, monitoring or review by, and/or disclosure to,
>>     someone other than the recipient.
>>     ************************************************************************************
>>
>