Since you haven't gotten an immediate answer yet, I'd recommend using wsdl2java from the command-line (or via Maven[1]) to rule out Eclipse being the issue, and furthermore (since you seem to just have three XSD's with the WSDL) running wsdl2java against file-system-located WSDLs/XSDs instead of pulling them via HTTP (to rule out that being the issue.) Finally, it's a trivial matter to run against Metro's wsdl2java equivalent[1] to see if it works, and if not, it might give you a more helpful error message as to what the problem is.

HTH,
Glen

[1] http://www.jroller.com/gmazza/entry/soap_client_tutorial

On 11/04/2012 10:47 PM, Ryan wrote:
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



--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza

Reply via email to