[ https://issues.apache.org/jira/browse/CXF-6937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15974542#comment-15974542 ]
fred assi commented on CXF-6937: -------------------------------- I will be investigating this issue > Dealing with empty soap:body together with MIME-Attachment in wsdl > ------------------------------------------------------------------ > > Key: CXF-6937 > URL: https://issues.apache.org/jira/browse/CXF-6937 > Project: CXF > Issue Type: Bug > Components: Soap Binding > Affects Versions: 3.1.6 > Environment: Windows 7, Java 1.8_74 > Reporter: Stefan Laube > Priority: Minor > > There are problems validating a wsdl and generating java-stubs from wsdl when > the wsdl-file contains an empty soap:body-definition while data is put to > MIME-Attachment. > In a wsdl-file, i need to specify an empty soap:body, while the > <message>-specific data needs to go to header and/ or attachment. > As far as i know, an empty soap:body is defined with: > {{<soap:body parts=""/>}} > This construct is used in two cases in the following showcase in line 61 and > line 71. > {code:title=showcase.wsdl|borderStyle=solid} > <?xml version="1.0"?> > <definitions name="Showcase" > targetNamespace="http://showcase.de/v1" > xmlns:tns="http://showcase.de/v1" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" > xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" > xmlns="http://schemas.xmlsoap.org/wsdl/"> > <documentation> > Showcase > demonstrate handling for empty soap:body together with attachments > </documentation> > <types> > <schema targetNamespace="http://showcase.de/v1" > xmlns="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified"> > <element name="DataTypeIn"> > <complexType> > <sequence> > <any processContents="skip" /> > </sequence> > </complexType> > </element> > <element name="DataTypeOut"> > <complexType> > <sequence> > <any processContents="skip" /> > </sequence> > </complexType> > </element> > </schema> > </types> > <message name="MyFuncReq"> > <part name="Version" type="xs:string" /> > <part name="DataReq" element="tns:DataTypeIn" /> > </message> > <message name="MyFuncRsp"> > <part name="DataRsp" element="tns:DataTypeOut" /> > </message> > <portType name="MyPort"> > <operation name="MyFunc"> > <input message="tns:MyFuncReq" /> > <output message="tns:MyFuncRsp" /> > </operation> > </portType> > <binding name="MySoapBinding" type="tns:MyPort"> > <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> > <operation name="MyFunc"> > <soap:operation soapAction="MyFunc" /> > <input> > <mime:multipartRelated> > <mime:part> > <soap:header message="tns:MyFuncReq" part="Version" > use="literal" /> > <soap:body parts=""/> > </mime:part> > <mime:part> > <mime:content part="DataReq" type="text/xml" /> > </mime:part> > </mime:multipartRelated> > </input> > <output> > <mime:multipartRelated> > <mime:part> > <soap:body parts=""/> > </mime:part> > <mime:part> > <mime:content part="DataRsp" type="text/xml" /> > </mime:part> > </mime:multipartRelated> > </output> > </operation> > </binding> > <service name="MyService"> > <port name="MyHttpSoapPort" binding="tns:MySoapBinding"> > <soap:address location="http://host:port/services/func_1/" /> > </port> > </service> > </definitions> > {code} > In the wsdl:input-definition (line 57ff.), the message-part "Version" is put > into soap:header, as mentioned no part shall be put into soap:body and the > "DataReq"-part is put into attachment. > In the wsdl:output-definition (line 68ff.), again, nothing shall be put into > soap:body while the "DataRsp"-part is put into attachment. > Now, when i validate this wsdl-file using the command line: > {{apache-cxf-3.1.6\bin\wsdlvalidator.bat showcase.wsdl}} > i get multiple error messages, basically saying: > {{cvc-minLength-valid: Value '' with length = '0' is not facet-valid with > respect to minLength '1' for type 'NMTOKENS'.}} > {{cvc-attribute.3: The value '' of attribute 'parts' on element 'soap:body' > is not valid with respect to its type, 'NMTOKENS'}} > As far as i understand these output, it is not allowed to define an empty > "parts"-element, thus no empty soap:body. > *But why?* > Now when i generate java-stubs from this wsdl-file, using the command line: > {{apache-cxf-3.1.6\bin\wsdl2java.bat" -verbose -d java_out showcase.wsdl}} > the resulting files seem to be ok (generated interfaces and classes can be > implemented/ extended) but during stub-generation i get the message: > {{INFORMATION: Operation \{http://showcase.de/v1}MyFunc cannot be unwrapped, > input and output messages (if present) must contain only a single part}} > which i don't know how to interpret. For me, it seems to be connected to the > error-messages during validation. > *Can this be ignored?* *Is anything left out in the generated stubs?* > Interestingly i get no such messages when generating the java-stubs using the > ant-task "com.sun.tools.ws.ant.WsImport" (having verbose=true). > Any clarification is appreciated. -- This message was sent by Atlassian JIRA (v6.3.15#6346)