axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "keith chapman" <keithgchap...@gmail.com>
Subject Re: Defining Custom WSDL
Date Mon, 13 Oct 2008 02:17:12 GMT
Hi,

<message name="addRequest">
  <part name="number1" type="xs:int"/>
  <part name="number2" type="xs:int"/
</message>

<message name="addResponse">
  <part name="result" type="xs:int"/>
</message>

<portType name="glossaryAdd">
 <operation name="add">
     <input message="addRequest"/>
     <output message="addResponse"/>
 </operation>
</portType>

Do not use the mechanism You've suggested (as above). If you do it this way
it would be a RPC type binding and you will find it hard to describe the
complex types, rather use a document approach as below,

<message name="addRequest">
  <part name="addRequest" type="ws:addRequestType"/>
</message>

<message name="addResponse">
  <part name="addResponse" type="ws:addResponseType"/>
</message>

<portType name="glossaryAdd">
 <operation name="add">
     <input message="addRequest"/>
     <output message="addResponse"/>
 </operation>
</portType>

Now you could define addRequest and addResponse using XML schema. Take a
look at this WSDL <http://mooshup.com/services/keith/RESTDemo?wsdl> [1] for
such an example

Thanks,
Keith.

[1] http://mooshup.com/services/keith/RESTDemo?wsdl

On Fri, Oct 10, 2008 at 10:38 PM, Aegis1888 <jaz.chana@cdms.co.uk> wrote:

>
> Hi guys,
>
> My work has come to a bit of a stand still because I am trying to define a
> complex data type that I cannot seem to describe in a wsdl. I'm new to web
> services so I bear with me if this doesn't come out right.
>
> I'm using axis2 to build my web services, which adheres to the SOAP
> specification. Now, I want my SOAP service to be as simple to use as
> possible. If I understand correctly, SOAP is just transfer of xml data
> between two services. Axis2 uses many different implementations to achieve
> this transfer both on client and server side, e.g, ADB, XMLBeans, AXIOM.
> The
> last implementation, AXIOM, parses the XML directly. The other
> implementations encapsulate the processing of this XML and this allows you
> to create a web service without the need to directly parse the xml message
> for data.
>
> I am trying to build a service with a simple request but a more complicated
> response. For example; I want to send the parameters; accountNumber, name.
> And I want my service to response with the following parameters;
> product1{name,price},product2{name,price}....In addition, I want to be able
> to send a response code so that every time I send a service call I am
> giving
> some indication as to whether or not the call was successful. For example
> if
> the call was successful than the response code is 0, if something went
> wrong
> the response code is 1. If I try to represent that using SOAP, I'm assuming
> the xml messages will look like this;
>
> request;
>
> <request>
>   <customer>
>     <accountNumber>S3</accountNumber>
>     <name>Solid Snake</name>
>   </cusomer>
> </request>
>
>
> response;
>
> <response>
>   <responseCode>1</responseCode>
>   <product1>
>      <name>Ration</name>
>      <price>1.00</price>
>   </product1>
>   <product2>
>      <name>CardboardBox</name>
>      <price>1.00</price>
>   </product2>
> </response>
>
>
> Follow so far?
>
> I have created the service using AXIOM, by adding these nodes directly to
> the SOAP body content. I have all also created a client to deal with this
> service using AXIOM. The service has one method that accepts the SOAP
> message and parses it to get the data and the client does something
> similar.
>
> Now the problem I have is that I don't want my client to be dependent on
> any
> implementation. In other words I want the client to be able to use ADB or
> XML Beans or whatever, regardless of whether or not I use AXIOM. So I
> thought I would create a custom WSDL, with custom complex datatypes so that
> anyone generating code from the wsdl will be able send the correct
> parameters. Confused? Okay lets look at a simple request-response;
>
>
> <request>
>   <number1>23</number1>
>   <number2>24</number2>
> </request>
>
>
>
> <response>
>   <result>47</result>
> </response>
>
>
> This service will take two numbers as its argument and add them together.
> Now i'm guessing here, but i think the wsdl will look something like this;
>
>
> ...
>
> <message name="addRequest">
>   <part name="number1" type="xs:int"/>
>   <part name="number2" type="xs:int"/
> </message>
>
> <message name="addResponse">
>   <part name="result" type="xs:int"/>
> </message>
>
> <portType name="glossaryAdd">
>  <operation name="add">
>      <input message="addRequest"/>
>      <output message="addResponse"/>
>  </operation>
> </portType>
>
> ...
>
>
> Given the above, assuming its all correct, my question is; how do I create
> the wsdl for the more complex example above?
> --
> View this message in context:
> http://www.nabble.com/Defining-Custom-WSDL-tp19922365p19922365.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org

Mime
View raw message