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:[email protected]] 
Sent: Montag, 5. November 2012 04:47
To: [email protected]
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

Reply via email to