views:

372

answers:

3
+1  Q: 

Problem with WSDL

I've recently been working on an ACORD P&C compliant web service and have run into some trouble with errors from wsimport saying it is unable to parse one of the xsd files. The error message is:

[ERROR]         Unable to parse "D:\projects\DICACORD\DicAcordQuoteRq.xsd" : Illegal character in opaque part at index 2: D:\projects\DICACORD\DicAcordQuoteRq.xsd

The schema I have created is based off of the ACORD P&C schema(over 23k lines) and I have only included the required elements that the company needs to use. I created the schemas using XMLSpy and according to its validation the schemas are valid but when I try to create the web service in netbeans 6.8 I get the error message above.

The schemas are on my development machine and according to what I can find on the netbeans forums netbeans copies the wsdl into a directory inside of the project so that when you move it to from development to production everything still works like it's supposed to.

The wsdl is as follows

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2010 -->
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="discoveryinsurance.com/schemas" xmlns:ns="discoveryinsurance.com/schemas/acordRq" xmlns:ns1="discoveryinsurance.com/schemas/acordRs" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="discoveryinsurance.com/schemas">
<wsdl:import namespace="discoveryinsurance.com/schemas/acordRq" location="D:\projects\DICACORD\DicAcordQuoteRq.xsd"/>
<wsdl:import namespace="discoveryinsurance.com/schemas/acordRs" location="D:\projects\DICACORD\DicAcordQuoteRs.xsd"/>
<wsdl:types>
 <xs:schema targetNamespace="discoveryinsurance.com/schemas" elementFormDefault="qualified"/>
</wsdl:types>
<wsdl:message name="NewMessageRequest">
 <wsdl:part name="parameter" element="ns:ACORD"/>
</wsdl:message>
<wsdl:message name="NewMessageResponse">
 <wsdl:part name="parameter" element="ns1:ACORD"/>
</wsdl:message>
<wsdl:portType name="QuotePort">
 <wsdl:operation name="QuoteRequest">
  <wsdl:input name="quoteInput" message="tns:NewMessageRequest"/>
  <wsdl:output name="quoteOutput" message="tns:NewMessageResponse"/>
 </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AgencyQuoteSOAP" type="tns:QuotePort">
 <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
 <wsdl:operation name="QuoteRequest">
  <soap:operation soapAction="urn:QuoteRequest" style="document"/>
  <wsdl:input>
   <soap:body use="literal"/>
  </wsdl:input>
  <wsdl:output>
   <soap:body use="literal"/>
  </wsdl:output>
 </wsdl:operation>
</wsdl:binding>
<wsdl:service name="AgencyQuote">
 <wsdl:port name="QuotePort" binding="tns:AgencyQuoteSOAP">
  <soap:address location="http://localhost:8084/DicQuoteSvc/AgencyQuote"/&gt;
 </wsdl:port>
</wsdl:service>

I feel like it's something to do with the namespaces but I'm not sure. This is also the first time I have tried to create a web service this way because I thought I would be saving myself some development time.

I've tried googling the error message and everything I have read points to an incorrect URI. I was thinking that XMLSpy's validation would catch an error like that but if that is the problem then it does not catch it.

Any help would be greatly appreciated and I'll be happy to provide any other needed information that I can.

A: 

It might be the slashes (\ vs /), try

D:/projects/DICACORD/DicAcordQuoteRs.xsd

If that doesn't work, try

file://D:/projects/DICACORD/DicAcordQuoteRs.xsd

karoberts
A: 

One thing I can think of is that according to the specification wsdl targetNamespace must be an absolute URI. See section 2.2 of the wsdl primer.

See the wikipedia on valid URI format.

DJ
+3  A: 

About the wsdl:import element, the WSDL 1.1 specification says:

WSDL allows associating a namespace with a document location using an import statement:

<definitions .... >
    <import namespace="uri" location="uri"/> *
</definitions>

(...)

URIs might be absolute or relative but yours is clearly invalid.

Of course, you could try to specify an absolute URI, maybe using file:// and/or forward slashes. But in your case, I think you should put your XSDs next to your WSDSL and use a relative URI, something like this:

<wsdl:import namespace="discoveryinsurance.com/schemas/acordRq" location="DicAcordQuoteRq.xsd"/>
<wsdl:import namespace="discoveryinsurance.com/schemas/acordRs" location="DicAcordQuoteRs.xsd"/>
Pascal Thivent
This answer fixed that problem so now I'm on to the next one. If I'm unable to figure it out I'll post another question. Thanks for the help.
ChadNC