wood burning stoves 2.0*
The moose likes Web Services and the fly likes webmethod of Doc/Lit bare style with only one header param generates part= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "webmethod of Doc/Lit bare style with only one header param generates part="" invalid wsdl soap:body" Watch "webmethod of Doc/Lit bare style with only one header param generates part="" invalid wsdl soap:body" New topic
Author

webmethod of Doc/Lit bare style with only one header param generates part="" invalid wsdl soap:body

Anitha Narayanan
Greenhorn

Joined: Apr 19, 2011
Posts: 7
Hi there,

I have a question regarding generated wsdl's soap:body of webmethod which is doc/lit bare style with only one header parameter.

I read BasicProfile V1.1 section 4.4.1 R2213 that soap:body can have empty string in their parts attribute. But if wsdl have parts="", i face below problem in Visual Studio. I'm using bottom-up approach. my web method and generated wsdl is given below.

R2213 In a doc-literal description where the value of the parts attribute of soapbind:body is an empty string, the corresponding ENVELOPE MUST have no element content in the soap:Body element.


Example webmethod:
@WebResult(name = "GetAllStockQuotesResponse", targetNamespace = "http://jaxwebsvcs/StockQuote", partName = "parameters")
@WebMethod(action = "getAllStockQuotes")
public StockQuoteList getAllStockQuotes(
@WebParam(partName = "header", name = "SecurityHeader", targetNamespace = "http://jaxwebsvcs/WebSvcHeader", header =true)
jaxwebsvcs.websvcheader.SecurityAttributes header
) throws ServiceException;

Part of Generated Wsdl:
<message name="getAllStockQuotes">
<part xmlns:ns4="http://jaxwebsvcs/WebSvcHeader" name="header" element="ns4:SecurityHeader" />
</message>
<message name="getAllStockQuotesResponse">
<part name="parameters" element="tns:GetAllStockQuotesResponse" />
</message>


<portType name="StockQuotePort">
<operation name="getAllStockQuotes">
<input wsam:Action="getAllStockQuotes" message="tns:getAllStockQuotes" />
<output wsam:Action="http://jaxwebsvcs/StockQuote/StockQuotePort/getAllStockQuotesResponse" message="tns:getAllStockQuotesResponse" />
<fault message="tns:ServiceException" name="ServiceException" wsam:Action="http://jaxwebsvcs/StockQuote/StockQuotePort/getAllStockQuotes/Fault/ServiceException" />
</operation>
</portType>

<binding name="StockQuotePortBinding" type="tns:StockQuotePort">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="getAllStockQuotes">
<soap12:operation soapAction="getAllStockQuotes" />
<input>
<soap12:body use="literal" parts="" />
<soap12:header message="tns:getAllStockQuotes" part="header" use="literal" />
</input>
<output>
<soap12:body use="literal" />
</output>
<fault name="ServiceException">
<soap12:fault name="ServiceException" use="literal" />
</fault>
</operation>
</binding>

Problem:
If i add this wsdl as web reference in VS2008 i'm getting following error.
Custom tool error: Unable to import WebService/Schema. Unable to import binding 'StockQuotePortBinding' from namespace 'http://jaxwebsvcs/StockQuote'. Unable to import operation 'getAllStockQuotes'. Missing message part '' for message 'getAllStockQuotes' from namespace 'http://jaxwebsvcs/StockQuote'.


Bare style can have zero arguments(parts = empty string) in their web method accordong to BasicProfile 1.1. [considering only non-header parameters consititute arguments below method is the zero argument web method only. So a valid wsdl only, but why VS2008 generates above custom tool error ?
Brief version of above webmethod
public StockQuoteList getAllStockQuotes(@WebParam(header=true) SecAttributes header)

i) How ever if i remove that SecurityAttributes header argument totally, part="" is not generated in the wsdl soap binding body. Therefore i'm able to add web reference without any issue.
ii) Also If i change the parameter style to doc/Lit wrapped, I'm able to add as web reference without any issue.

Is it rule that bare parameter style should have atleast one non-header parameter if it has atleast one header parameter ?
Is it possible to take that parts="" from wsdl without manually editing the wsdl ?
Am i missing any properties of annotations, which adds parts="" for soap:body ?
Can some one help me out with this error ? Please....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: webmethod of Doc/Lit bare style with only one header param generates part="" invalid wsdl soap:body
 
Similar Threads
problem calling a remote webservice [ Algo Error]
Problem returning a String array from a web service
MTOM example
binding and service elements in wsdl
binding and service elements in wsdl