Anne Thomas Manes wrote:
Anne, thanks again for your detailed response! I appreciate it because I couldn't find anywhere with good documentation on responses.<soap:Body> cannot contain text content, so the response must be returned as a child element of the <soap:Body>. Also, when using wrapped or document, the message part must reference an element, not a type. It seems to me that, since you must add a wrapper element when returning a scalar value, it's more consistent to always add the wrapper element. Also, as you said, this is also the .NET convention. Ie, int getUserAge(String name)returns <soapenv:Body> <tns:getUserAgeResponse> 5 </tns:getUserAgeResponse> </soapenv:Body>Therefore (for consistency) User getUser(String name)returns <soapenv:Body> <tns:getUserResponse> <user> ... </user> </tns:getUserResponse> </soapenv:Body>I understand that this isn't a requirement, just a convention. Bill So what I'm saying is that wrapped/literal is doc/literal. Elements that you define as your request and response message parts are what will be sent as the child element of the <soap:Body>. e.g.:<wsdl:message name="getUserRequest"> <wsdl:part name="parameters" element="tns:getUser"/> </wsdl:message> results in: <soapenv:Body> <tns:getUser xmlns:tns="..." /> </soapenv:Body> and <wsdl:message name="getUserResponse"> <wsdl:part name="parameters" element="tns:user"/> </wsdl:message> results in <soapenv:Body> <tns:user xmlns:tns="..." /> </soapenv:Body> Whether using wrapped or document style, the <soap:Body> must contain at most one direct child element. (i.e., at most one body part). When using wrapped, the convention is that the request message body part element has the same name as the operation name. There's no specific convention for the return message, but it should map to the return value for the operation. When using document, the request message body part doesn't have the same name as the operation, but it still must contain at most one part. -Anne On Thu, 13 Jan 2005 12:43:03 +0900, Bill Keese <[EMAIL PROTECTED]> wrote:Cool, thanks! Are you implying that document/literal and wrapped/literal are the same w.r.t. the return value? The difference is only for the request? Also, does your answer implay that a scalar return value can be represented simply like this? <soapenv:Body> Hello World! </soapenv:Body> And the WSDL would be this? <wsdl:message name="getUserResponse"><wsdl:part name="parameters"type="xsd:string"/></wsdl:message> BillAnne Thomas Manes wrote: If you want your return value to be a User object, then that should beyourreturn structure, not getUserResponse. i.e.,<soapenv:Body> <user> <name>John Smith</name> <address>10 MainSt.</address></user> </soapenv:Body> The output message should be definedso:<wsdl:message name="getUserResponse"> <wsdl:part name="parameters"element="tns:user"/></wsdl:message> - Anne On Wed, 12 Jan 2005 18:41:24+0900, Bill Keese<[EMAIL PROTECTED]> wrote:I have a few questions about return values from a method in awrapped/literal server. (1) My getUser() method returns astructure:User getUser(String id); I know that for wrapped/literal theinput message should be<soapenv:Body> <getUser> <id>jsmith</id> </getUser> </soapenv:Body> Whatshould the response be, such that a client's generated stubs (forwrapped/literal mode) don't contain any unnecessary structures? IE,ifthis is the returnvalue:<soapenv:Body> <getUserResponse> <user> <name>JohnSmith</name><address>10 MainSt.</address></user> </getUser> </soapenv:Body> Will .NET generate afunction stub like this?User getUser(String id) or will it generate a stublike this?GetUserResponse getUser(String id); where GetUserResponse is adummy wrapper class like this:class GetUserResponse { User user; } (2)Has anyone gotten this to work with Axis? I hand-wrote my WSDL file,andthen used WSDL2Java to generate the deploy.wsdd file. I see twoproblems inmy testing but I wonder if anyone can confirm or deny.a) Axis seems to wantto print 2 nested tags<soapenv:Body> <getUserResponse> <getUserResult> ... </getUserResult> </getUserResponse Ithink <getUserResponse> is parallel to the <getUser> (wrapper tag),and<getUserResult> is possibly to differentiate between the returnvalue andoutput parameters.b) The <user> tag itself is not printed; only the fieldsinside of theUser class are printed. It's as though Axis is assuming theUser classis a wrapper class that contains a list of output values Cananyone comment on these things? Thanks!Bill |
- wrapped/literal: complex return value Bill Keese
- Re: wrapped/literal: complex return value Anne Thomas Manes
- Re: wrapped/literal: complex return value Bill Keese
- Re: wrapped/literal: complex return value Anne Thomas Manes
- Bill Keese