cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan <grigg...@gmail.com>
Subject Re: Error generating CXF client for .Net WCF file upload service
Date Thu, 08 Nov 2012 05:01:44 GMT
Thanks for your suggestions Dan and Andrei. Setting -exsh true does change
the outgoing soap envelope to include the additional parameters. However,
I'm still getting the 400 Bad Request message back so that probably isn't
the root cause.

I've been doing a bit more digging and compared the soap messages that WCF
clients send (which work fine) to the ones that the CXF client sends and
managed to intercept an actual stack trace on the server side that may help
point out what the issue is. This is what I'm getting:

System.ServiceModel.CommunicationException: Error creating a reader for the
MTOM message ---> System.Xml.XmlException: MIME part with Content-ID '<
root.message@cxf.apache.org>' not found.

Based on the error message on the server, the XOP starting header is
missing but my interceptor on the CXF side shows it is there:

--uuid:70dd56ae-7102-45c9-a5d9-b0078ad6ad13
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
...
</soap:Envelope>

--uuid:70dd56ae-7102-45c9-a5d9-b0078ad6ad13
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <4e2a3954-d8ec-490d-a844-ab55594e9c80-1@tempuri.org>

...file content...

Is WCF being stupid or does something need to be changed on the CXF side?

Ryan


On Wed, Nov 7, 2012 at 2:01 PM, Daniel Kulp <dkulp@apache.org> wrote:

>
> According to spec, the interface used for the generated code is only
> mapped from the information in the portType.   The extra header information
> isn't available as part of the portType and thus is not mapped.
>
> However, if you add -exsh true to your wsdl2java command line, then it
> will examine the binding for additional soap headers and map them to
> parameters.     That may work for this.
>
> HOWEVER, you likely do need to turn off the -validation.   The
> WSI-BasicProfile would prohibit the wsdl:message with multiple parts in it
> that are defined by "element".   It may flag the RemoteFile_Headers due to
> the second part in there.
>
>
>
> Dan
>
>
>
>
> On Nov 7, 2012, at 11:20 AM, Ryan <griggsrl@gmail.com> wrote:
>
> > Andrei, I'll give that a try later today but one question...given this
> > snippet from my WSDL:
> >
> > ...
> >    <wsdl:message name="RemoteFile">
> >        <wsdl:part name="parameters" element="tns:RemoteFile"/>
> >    </wsdl:message>
> >    <wsdl:message name="RemoteFile_Headers">
> >        <wsdl:part name="FileName" element="tns:FileName"/>
> >        <wsdl:part name="Length" element="tns:Length"/>
> >    </wsdl:message>
> > ...
> >        <wsdl:operation name="UploadFile">
> >            <soap:operation soapAction="
> http://tempuri.org/IFile/UploadFile"
> > style="document"/>
> >            <wsdl:input name="RemoteFile">
> >                <soap:header message="tns:RemoteFile_Headers"
> > part="FileName" use="literal"/>
> >                <soap:header message="tns:RemoteFile_Headers"
> part="Length"
> > use="literal"/>
> >                <soap:body use="literal"/>
> >            </wsdl:input>
> >            <wsdl:output>
> >                <soap:body use="literal"/>
> >            </wsdl:output>
> >        </wsdl:operation>
> > ...
> >
> > Why aren't the SOAP headers being created with the FileName and Length
> > values? The FileName and Length should be going into the headers and the
> > byte[] with the file content should be in the body according to this, or
> am
> > I missing something?
>
>
>
>
>
> >
> > Thanks,
> > Ryan
> >
> >
> > On Wed, Nov 7, 2012 at 4:09 AM, Andrei Shakirin <ashakirin@talend.com
> >wrote:
> >
> >> Your WSDL defines RemoteFile message as input for UploadFile operation.
> >> But RemoteFile message contains only one part with element
> RemoteFile.****
> >>
> >> Therefore generated operation has only one parameter - RemoteFile
> element.
> >> ****
> >>
> >> ** **
> >>
> >> If you replace RemoteFile message to RemoteFile_Headers in operation and
> >> add RemoteFile part into RemoteFile_Headers, operation will be generated
> >> with all three parameters:****
> >>
> >> ** **
> >>
> >> …****
> >>
> >>    <wsdl:message name="RemoteFile_Headers">****
> >>
> >>        <wsdl:part name="FileName" element="tns:FileName"/>****
> >>
> >>        <wsdl:part name="Length" element="tns:Length"/>****
> >>
> >>        <wsdl:part name="parameters" element="tns:RemoteFile"/>****
> >>
> >>    </wsdl:message>****
> >>
> >> ..****
> >>
> >> ** **
> >>
> >>    <wsdl:portType name="IFile">****
> >>
> >>        <wsdl:operation name="UploadFile">****
> >>
> >>            <wsdl:input wsaw:Action="http://tempuri.org/IFile/UploadFile
> "
> >> name="RemoteFile" message="tns:RemoteFile_Headers"/>****
> >>
> >>            <wsdl:output wsaw:Action="
> >> http://tempuri.org/IFile/UploadFileResponse"
> >> message="tns:IFile_UploadFile_OutputMessage"/>****
> >>
> >>        </wsdl:operation>****
> >>
> >>    </wsdl:portType>****
> >>
> >> ** **
> >>
> >> …****
> >>
> >> ** **
> >>
> >>    @WebMethod(operationName = "UploadFile", action = "
> >> http://tempuri.org/IFile/UploadFile")****
> >>
> >>    public void uploadFile(****
> >>
> >>        @WebParam(partName = "FileName", name = "FileName",
> >> targetNamespace = "http://tempuri.org/", header = true)****
> >>
> >>        java.lang.String fileName,****
> >>
> >>        @WebParam(partName = "Length", name = "Length", targetNamespace
> = "
> >> http://tempuri.org/", header = true)****
> >>
> >>        long length,****
> >>
> >>        @WebParam(partName = "parameters", name = "RemoteFile",
> >> targetNamespace = "http://tempuri.org/")****
> >>
> >>        RemoteFile parameters****
> >>
> >>    );****
> >>
> >> ** **
> >>
> >> Cheers,****
> >>
> >> Andrei.****
> >>
> >> ** **
> >>
> >> ** **
> >>
> >> *From:* Ryan [mailto:griggsrl@gmail.com]
> >> *Sent:* Mittwoch, 7. November 2012 06:03
> >> *To:* Andrei Shakirin
> >>
> >> *Cc:* users@cxf.apache.org
> >> *Subject:* Re: Error generating CXF client for .Net WCF file upload
> >> service****
> >>
> >> ** **
> >>
> >> So, after playing around with it again a bit, I've found that taking the
> >> -validate flag off the wsdl2java command causes it to complete without
> an
> >> exception so that is good.
> >>
> >> The bad news is that something is still not quite right, because the
> >> RemoteFile class that it generates has only one of the three parameters.
> >> It's supposed to have the byte[], the byte[] length and the original
> file
> >> name. It only generates a class member for the byte[] parameter which is
> >> the message body and is missing the two parameters that are in the
> message
> >> header. Just for grins, I loaded a byte[] with the contents of a small
> text
> >> file on my system in the generated client class and executed it anyway.
> It
> >> immediately threw an exception:
> >>
> >> Exception in thread "main" javax.xml.ws.WebServiceException: Could not
> >> send Message.
> >>    at
> >> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
> >>    at $Proxy29.uploadFile(Unknown Source)
> >>    at
> >>
> org.tempuri.I<XXX>File_<XXX>FileEndpoint_Client.main(I<XXX>File_<XXX>FileEndpoint_Client.java:68)
> >> Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response
> >> '400: Bad Request' when communicating with http://localhost:10186/
> >> <XXX>File.svc
> >>
> >> So I added the file name and byte[] length class members to the
> generated
> >> RemoteFile class and set the values in the client's main method.
> >> Unfortunately I got the exact same exception and message.
> >>
> >> I added an interceptor to capture the outgoing SOAP message and this is
> >> what is being sent:
> >>
> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> >>    <soap:Body>
> >>        <RemoteFile xmlns="http://tempuri.org/" xmlns:ns2="
> >> http://schemas.microsoft.com/2003/10/Serialization/">
> >>            <FileName>C:\test.txt</FileName>
> >>            <Length>2329</Length>
> >>            <FileByteStream>
> >>                <xop:Include xmlns:xop="
> >> http://www.w3.org/2004/08/xop/include" href="
> >> cid:ff61a81c-fa51-46fe-a721-4e524c5f0d02-1@tempuri.org"/>
> >>            </FileByteStream>
> >>        </RemoteFile>
> >>    </soap:Body>
> >> </soap:Envelope>
> >>
> >> Going back to the originally generated RemoteFile, this is my outgoing
> >> SOAP envelope:
> >>
> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> >>    <soap:Body>
> >>        <RemoteFile xmlns="http://tempuri.org/" xmlns:ns2="
> >> http://schemas.microsoft.com/2003/10/Serialization/">
> >>            <FileByteStream>
> >>                <xop:Include xmlns:xop="
> >> http://www.w3.org/2004/08/xop/include" href="
> >> cid:ff61a81c-fa51-46fe-a721-4e524c5f0d02-1@tempuri.org"/>
> >>            </FileByteStream>
> >>        </RemoteFile>
> >>    </soap:Body>
> >> </soap:Envelope>
> >>
> >> It seems the FileName and Length parameters are just never being added
> to
> >> the message, or for that matter even showing up in the generated Java
> >> classes. I'd expect the message to look like this (and is what the .Net
> WCF
> >> clients send if I remember correctly off the top of my head):
> >>
> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> >>    <soap:Header>
> >>        <FileName>C:\test.txt</FileName>
> >>        <Length>2329</Length>
> >>    </soap:Header>
> >>    <soap:Body>
> >>        <RemoteFile xmlns="http://tempuri.org/" xmlns:ns2="
> >> http://schemas.microsoft.com/2003/10/Serialization/">
> >>            <FileByteStream>
> >>                <xop:Include xmlns:xop="
> >> http://www.w3.org/2004/08/xop/include" href="
> >> cid:ff61a81c-fa51-46fe-a721-4e524c5f0d02-1@tempuri.org"/>
> >>            </FileByteStream>
> >>        </RemoteFile>
> >>    </soap:Body>
> >> </soap:Envelope>
> >>
> >> So the question is, what is happening to the FileName and Length part of
> >> the message on the CXF side?
> >>
> >> Ryan****
> >>
> >> ** **
> >>
> >> On Tue, Nov 6, 2012 at 11:29 AM, Andrei Shakirin <ashakirin@talend.com>
> >> wrote:****
> >>
> >> Just tried "wsdl2java.bat tempuri.wsdl" with locally saved wsdl and
> >> schemas.****
> >>
> >>
> >> Andrei.
> >>
> >> -----Original Message-----
> >> From: Ryan [mailto:griggsrl@gmail.com]****
> >>
> >> Sent: Dienstag, 6. November 2012 18:18
> >> To: Daniel Kulp
> >> Cc: users@cxf.apache.org
> >> Subject: Re: Error generating CXF client for .Net WCF file upload
> service
> >>
> >> Daniel, I'll try that a bit later today, thanks.
> >>
> >> Andrei, what command line values did you use that succeeded? I'm curious
> >> to see if there are any differences between what you ran and what
> Eclipse
> >> used on my side.
> >>
> >> Ryan
> >>
> >>
> >> On Tue, Nov 6, 2012 at 11:09 AM, Daniel Kulp <dkulp@apache.org> wrote:
> >>
> >>>
> >>> Try removing the -validate flag from the command line.   There are some
> >>> issues with the validation with 2.7.0.   Actually, if you can, try the
> >>> 2.7.1-SNAPSHOTs.   I hope the issues are fixed, but it would be great
> if
> >>> you could verify that.
> >>>
> >>> Dan
> >>>
> >>>
> >>>
> >>> On Nov 6, 2012, at 11:00 AM, Ryan <griggsrl@gmail.com> wrote:
> >>>
> >>>> You're right Andrei, somehow some of the prefix declarations in my
> >>> original
> >>>> message didn't make it. Oops. Here are my WSDL and XSDs again,
> >>>> hopefully with all of the info this time.
> >>>>
> >>>> WSDL:
> >>>>
> >>>> <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="File"
> >>>>   targetNamespace="http://tempuri.org/"
> >>>>   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >>>>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >>>>   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> >>>>   xmlns:wsu="
> >>>>
> >>> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-uti
> >>> lity-1.0.xsd
> >>> "
> >>>>
> >>>>   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >>>>   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> >>>>   xmlns:tns="http://tempuri.org/"
> >>>>   xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
> >>>>   xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
> >>>>   xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy
> >> "
> >>>>   xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
> >>>>   xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
> >>>>   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
> >>>>   xmlns:wsa10="http://www.w3.org/2005/08/addressing"
> >>>>   xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
> >>>>   <wsp:Policy wsu:Id="FileEndpoint_policy">
> >>>>       <wsp:ExactlyOne>
> >>>>           <wsp:All>
> >>>>               <wsoma:OptimizedMimeSerialization xmlns:wsoma="
> >>>> http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserializat
> >>>> ion
> >>> "/>
> >>>>           </wsp:All>
> >>>>       </wsp:ExactlyOne>
> >>>>   </wsp:Policy>
> >>>>   <wsdl:types>
> >>>>       <xsd:schema targetNamespace="http://tempuri.org/Imports">
> >>>>           <xsd:import schemaLocation="1.xsd" namespace="
> >>>> http://tempuri.org/"/>
> >>>>           <xsd:import schemaLocation="0.xsd" namespace="
> >>>> http://schemas.microsoft.com/Message"/>
> >>>>           <xsd:import schemaLocation="2.xsd" namespace="
> >>>> http://schemas.microsoft.com/2003/10/Serialization/"/>
> >>>>       </xsd:schema>
> >>>>   </wsdl:types>
> >>>>   <wsdl:message name="RemoteFile">
> >>>>       <wsdl:part name="parameters" element="tns:RemoteFile"/>
> >>>>   </wsdl:message>
> >>>>   <wsdl:message name="RemoteFile_Headers">
> >>>>       <wsdl:part name="FileName" element="tns:FileName"/>
> >>>>       <wsdl:part name="Length" element="tns:Length"/>
> >>>>   </wsdl:message>
> >>>>   <wsdl:message name="IFile_UploadFile_OutputMessage"/>
> >>>>   <wsdl:portType name="IFile">
> >>>>       <wsdl:operation name="UploadFile">
> >>>>           <wsdl:input wsaw:Action="
> >> http://tempuri.org/IFile/UploadFile"
> >>>> name="RemoteFile" message="tns:RemoteFile"/>
> >>>>           <wsdl:output wsaw:Action="
> >>>> http://tempuri.org/IFile/UploadFileResponse"
> >>>> message="tns:IFile_UploadFile_OutputMessage"/>
> >>>>       </wsdl:operation>
> >>>>   </wsdl:portType>
> >>>>   <wsdl:binding name="FileEndpoint" type="tns:IFile">
> >>>>       <wsp:PolicyReference URI="#FileEndpoint_policy"/>
> >>>>       <soap:binding transport="http://schemas.xmlsoap.org/soap/http
> >> "/>
> >>>>       <wsdl:operation name="UploadFile">
> >>>>           <soap:operation soapAction="
> >>> http://tempuri.org/IFile/UploadFile"
> >>>> style="document"/>
> >>>>           <wsdl:input name="RemoteFile">
> >>>>               <soap:header message="tns:RemoteFile_Headers"
> >>>> part="FileName" use="literal"/>
> >>>>               <soap:header message="tns:RemoteFile_Headers"
> >>> part="Length"
> >>>> use="literal"/>
> >>>>               <soap:body use="literal"/>
> >>>>           </wsdl:input>
> >>>>           <wsdl:output>
> >>>>               <soap:body use="literal"/>
> >>>>           </wsdl:output>
> >>>>       </wsdl:operation>
> >>>>   </wsdl:binding>
> >>>>   <wsdl:service name="File">
> >>>>       <wsdl:port name="FileEndpoint" binding="tns:FileEndpoint">
> >>>>           <soap:address location="http://localhost:10186/File.svc"/>
> >>>>       </wsdl:port>
> >>>>   </wsdl:service>
> >>>> </wsdl:definitions>
> >>>>
> >>>> XSD 0:
> >>>>
> >>>> <?xml version="1.0" encoding="UTF-8"?> <xs:schema
> >>>> elementFormDefault="qualified"
> >>>>   targetNamespace="http://schemas.microsoft.com/Message"
> >>>>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >>>>   xmlns:tns="http://schemas.microsoft.com/Message">
> >>>>   <xs:simpleType name="StreamBody">
> >>>>       <xs:restriction base="xs:base64Binary"/>
> >>>>   </xs:simpleType>
> >>>> </xs:schema>
> >>>>
> >>>> XSD 1:
> >>>>
> >>>> <?xml version="1.0" encoding="UTF-8"?> <xs:schema
> >>>> elementFormDefault="qualified"
> >>>>   targetNamespace="http://tempuri.org/"
> >>>>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >>>>   xmlns:tns="http://tempuri.org/">
> >>>>   <xs:import schemaLocation="0.xsd" namespace="
> >>>> http://schemas.microsoft.com/Message"/>
> >>>>   <xs:element name="RemoteFile">
> >>>>       <xs:complexType>
> >>>>           <xs:sequence>
> >>>>               <xs:element name="FileByteStream" type="q1:StreamBody"
> >>>> xmlns:q1="http://schemas.microsoft.com/Message"/>
> >>>>           </xs:sequence>
> >>>>       </xs:complexType>
> >>>>   </xs:element>
> >>>>   <xs:element name="FileName" nillable="true" type="xs:string"/>
> >>>>   <xs:element name="Length" type="xs:long"/> </xs:schema>
> >>>>
> >>>> XSD 2:
> >>>>
> >>>> <?xml version="1.0" encoding="UTF-8"?> <xs:schema
> >>>> attributeFormDefault="qualified"
> >>>>   elementFormDefault="qualified"
> >>>>   targetNamespace="
> >> http://schemas.microsoft.com/2003/10/Serialization/"
> >>>>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >>>>   xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
> >>>>   <xs:element name="anyType" nillable="true" type="xs:anyType"/>
> >>>>   <xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
> >>>>   <xs:element name="base64Binary" nillable="true"
> >>> type="xs:base64Binary"/>
> >>>>   <xs:element name="boolean" nillable="true" type="xs:boolean"/>
> >>>>   <xs:element name="byte" nillable="true" type="xs:byte"/>
> >>>>   <xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
> >>>>   <xs:element name="decimal" nillable="true" type="xs:decimal"/>
> >>>>   <xs:element name="double" nillable="true" type="xs:double"/>
> >>>>   <xs:element name="float" nillable="true" type="xs:float"/>
> >>>>   <xs:element name="int" nillable="true" type="xs:int"/>
> >>>>   <xs:element name="long" nillable="true" type="xs:long"/>
> >>>>   <xs:element name="QName" nillable="true" type="xs:QName"/>
> >>>>   <xs:element name="short" nillable="true" type="xs:short"/>
> >>>>   <xs:element name="string" nillable="true" type="xs:string"/>
> >>>>   <xs:element name="unsignedByte" nillable="true"
> >>> type="xs:unsignedByte"/>
> >>>>   <xs:element name="unsignedInt" nillable="true"
> >> type="xs:unsignedInt"/>
> >>>>   <xs:element name="unsignedLong" nillable="true"
> >>> type="xs:unsignedLong"/>
> >>>>   <xs:element name="unsignedShort" nillable="true"
> >>>> type="xs:unsignedShort"/>
> >>>>   <xs:element name="char" nillable="true" type="tns:char"/>
> >>>>   <xs:simpleType name="char">
> >>>>       <xs:restriction base="xs:int"/>
> >>>>   </xs:simpleType>
> >>>>   <xs:element name="duration" nillable="true" type="tns:duration"/>
> >>>>   <xs:simpleType name="duration">
> >>>>       <xs:restriction base="xs:duration">
> >>>>           <xs:pattern
> >>>> value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
> >>>>           <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
> >>>>           <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
> >>>>       </xs:restriction>
> >>>>   </xs:simpleType>
> >>>>   <xs:element name="guid" nillable="true" type="tns:guid"/>
> >>>>   <xs:simpleType name="guid">
> >>>>       <xs:restriction base="xs:string">
> >>>>           <xs:pattern
> >>>>
> >>> value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA
> >>> -F]{12}"/>
> >>>>       </xs:restriction>
> >>>>   </xs:simpleType>
> >>>>   <xs:attribute name="FactoryType" type="xs:QName"/>
> >>>>   <xs:attribute name="Id" type="xs:ID"/>
> >>>>   <xs:attribute name="Ref" type="xs:IDREF"/> </xs:schema>
> >>>>
> >>>> I've downloaded the WSDL and the XSDs locally and validated it with
> >>>> no issues. I haven't have a chance to run wsdl2java directly against
> >>>> the
> >>> local
> >>>> copies instead of from within Eclipse yet.
> >>>>
> >>>>
> >>>> On Mon, Nov 5, 2012 at 7:16 AM, Andrei Shakirin
> >>>> <ashakirin@talend.com
> >>>> wrote:
> >>>>
> >>>>> As far as I can see, "q1" namespace prefix is used, but not
> >>>>> declared in schema xsd=xsd1.
> >>>>> WSDL and schemas also miss number of prefixes declarations: wsdl;
> >>>>> xs; soap; wsp; wsu.
> >>>>>
> >>>>> I suggest you to validate your WSDL with any tool: Eclipse, XMLSpy,
> >> etc.
> >>>>>
> >>>>> Regards,
> >>>>> Andrei.
> >>>>>
> >>>>> -----Original Message-----
> >>>>> From: Ryan [mailto:griggsrl@gmail.com]
> >>>>> Sent: Montag, 5. November 2012 04:47
> >>>>> To: users@cxf.apache.org
> >>>>> Subject: Error generating CXF client for .Net WCF file upload
> >>>>> service
> >>>>>
> >>>>> I'm having some issues generating a CXF client for a file upload
> >>>>> service in WCF and am hoping for some guidance. I've been
> >>>>> troubleshooting from
> >>> the
> >>>>> WCF side for a couple weeks with help from MSDN and Asp.Net forums
> >>>>> and
> >>> have
> >>>>> run out of ideas on that side at least for now.
> >>>>>
> >>>>> The WSDLToJava command (from within Eclipse) and the exception I'm
> >>> getting
> >>>>> is as follows:
> >>>>>
> >>>>> wsdl2java -client -d C:\Users\Ryan\workspace\WcfProxy\.cxftmp/src
> >>>>> -classdir C:\Users\Ryan\workspace\WcfProxy\build\classes -p
> >>>>> http://tempuri.org/=org.tempuri -impl -validate -exsh false -dns
> >>>>> true -dex true -wsdlLocation
> >>>>> http://localhost:10186/UploadFile.svc?wsdl
> >>>>> -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1
> >>>>> http://localhost:10186/UploadFile.svc?wsdl
> >>>>> wsdl2java - Apache CXF 2.7.0
> >>>>>
> >>>>> WSDLToJava Error: Schema Error : src-resolve: Cannot resolve the
> >>>>> name 'ns0:StreamBody' to a(n) 'type definition' component.
> >>>>>
> >>>>> My WSDL is:
> >>>>>
> >>>>> <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions
> >>>>> name="UploadFile" targetNamespace="http://tempuri.org/"><wsp:Policy
> >>>>> wsu:Id="BasicHttpBinding_IUploadFile_policy">
> >>>>>   <wsp:ExactlyOne>
> >>>>>       <wsp:All>
> >>>>>           <wsoma:OptimizedMimeSerialization/>
> >>>>>       </wsp:All>
> >>>>>   </wsp:ExactlyOne></wsp:Policy><wsdl:types>
> >>>>>   <xsd:schema targetNamespace="http://tempuri.org/Imports">
> >>>>>       <xsd:import
> >>>>> schemaLocation="http://localhost:10186/UploadFile.svc?xsd=xsd1"
> >>>>> namespace="http://tempuri.org/"/>
> >>>>>       <xsd:import
> >>>>> schemaLocation="http://localhost:10186/UploadFile.svc?xsd=xsd0"
> >>>>> namespace="http://schemas.microsoft.com/Message"/>
> >>>>>       <xsd:import
> >>>>> schemaLocation="http://localhost:10186/UploadFile.svc?xsd=xsd2"
> >>>>> namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
> >>>>>   </xsd:schema></wsdl:types><wsdl:message name="RemoteFile">
> >>>>>   <wsdl:part name="parameters"
> >>>>> element="tns:RemoteFile"/></wsdl:message><wsdl:message
> >>>>> name="RemoteFile_Headers">
> >>>>>   <wsdl:part name="FileName" element="tns:FileName"/>
> >>>>>   <wsdl:part name="Length"
> >>>>> element="tns:Length"/></wsdl:message><wsdl:message
> >>>>> name="IUploadFile_DownloadFile_InputMessage"/><wsdl:portType
> >>>>> name="IUploadFile">
> >>>>>   <wsdl:operation name="UploadFile">
> >>>>>       <wsdl:input
> >>>>> wsaw:Action="http://tempuri.org/IUploadFile/UploadFile"
> >>>>> name="RemoteFile" message="tns:RemoteFile"/>
> >>>>>   </wsdl:operation>    </wsdl:portType><wsdl:binding
> >>>>> name="BasicHttpBinding_IUploadFile" type="tns:IUploadFile">
> >>>>>   <wsp:PolicyReference URI="#BasicHttpBinding_IUploadFile_policy"/>
> >>>>>   <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
> >>>>>   <wsdl:operation name="UploadFile">
> >>>>>       <soap:operation
> >>>>> soapAction="http://tempuri.org/IUploadFile/UploadFile"
> >>>>> style="document"/>
> >>>>>       <wsdl:input name="RemoteFile">
> >>>>>           <soap:header message="tns:RemoteFile_Headers"
> >>>>> part="FileName" use="literal"/>
> >>>>>           <soap:header message="tns:RemoteFile_Headers"
> >>>>> part="Length" use="literal"/>
> >>>>>           <soap:body use="literal"/>
> >>>>>       </wsdl:input>
> >>>>>   </wsdl:operation></wsdl:binding><wsdl:service name="UploadFile">
> >>>>>   <wsdl:port name="BasicHttpBinding_IUploadFile"
> >>>>> binding="tns:BasicHttpBinding_IUploadFile">
> >>>>>       <soap:address location="http://localhost:10186/UploadFile.svc
> >> "/>
> >>>>>   </wsdl:port></wsdl:service></wsdl:definitions>
> >>>>>
> >>>>> My first thought was that there had to be a problem with the
> >>>>> xsd:import statements, so I followed those to see their content.
> >>>>> Here's the schema
> >>> at
> >>>>> "....=xsd1":
> >>>>>
> >>>>> <xs:schema elementFormDefault="qualified" targetNamespace="
> >>>>> http://tempuri.org/">
> >>>>> <xs:import schemaLocation="
> >>>>> http://localhost:10186/UploadFile.svc?xsd=xsd0"
> >>>>> namespace="http://schemas.microsoft.com/Message"/>
> >>>>> <xs:element name="RemoteFile">
> >>>>>   <xs:complexType>
> >>>>>     <xs:sequence>
> >>>>>       <xs:element name="FileByteStream" type="q1:StreamBody"/>
> >>>>>     </xs:sequence>
> >>>>>   </xs:complexType>
> >>>>> </xs:element>
> >>>>> <xs:element name="FileName" nillable="true" type="xs:string"/>
> >>>>> <xs:element name="Length" type="xs:long"/> </xs:schema>
> >>>>>
> >>>>> And here's the schema that imports from "...=xsd0":
> >>>>>
> >>>>> <xs:schema elementFormDefault="qualified"
> >>>>> targetNamespace="http://schemas.microsoft.com/Message">
> >>>>> <xs:simpleType name="StreamBody">
> >>>>>   <xs:restriction base="xs:base64Binary"/>  </xs:simpleType>
> >>>>> </xs:schema>
> >>>>>
> >>>>> Now, I'm no WSDL expert, but it seems that everything in the WSDL
> >>>>> and imports matches up. I've created lots of .Net ASMX webservices
> >>>>> (the predecessor to WCF) that have interop'ed with Java clients
> >>>>> (and vice
> >>> versa)
> >>>>> just fine but this is the first attempt using WCF instead of ASMX.
> >>>>> The kicker is that .Net clients consume this service with no issue
> >>>>> of
> >>> course.
> >>>>>
> >>>>> If anyone has some insight into this, I'd greatly appreciate
> >>>>> another set of eyes on this.
> >>>>>
> >>>>> Thanks,
> >>>>> Ryan
> >>>>>
> >>>
> >>> --
> >>> Daniel Kulp
> >>> dkulp@apache.org - http://dankulp.com/blog Talend Community Coder -
> >>> http://coders.talend.com
> >>>
> >>> ****
> >>
> >> ** **
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message