views:

337

answers:

3

The problem I'm having is that when I attempt to create a web service in netbeans using this wsdl, netbeans says that there is no service defined. I'm new to the whole wsdl thing but as far as I can tell there is one defined.

The wsdl is:

 <?xml version="1.0" encoding="UTF-8"?>
 <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="http://discoveryinsurance.com/DicQuoteSvc/AgencyQuote.wsdl" xmlns:ns="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRq.xsd" xmlns:na="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRs.xsd" targetNamespace="http://discoveryinsurance.com/DicQuoteSvc/AgencyQuote.wsdl"&gt;
<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRq.xsd"/>
<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRs.xsd"/>
<wsdl:types>
 <xs:schema targetNamespace="http://discoveryinsurance.com/DicQuoteSvc/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="na:ACORD"/>
</wsdl:message>
<wsdl:portType name="QuotePortType">
 <wsdl:operation name="RequestQuote">
  <wsdl:input message="tns:NewMessageRequest"/>
  <wsdl:output message="tns:NewMessageResponse"/>
 </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="QuoteBinding" type="tns:QuotePortType">
 <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
 <wsdl:operation name="RequestQuote">
  <soap:operation soapAction="http://discoveryinsurance.com/DicQuoteSvc/AgencyQuote" style="rpc"/>
  <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="QuotePortType" binding="tns:QuoteBinding">
  <soap:address  location="http://discoveryinsurance.com/DicQuoteSvc/"/&gt;
 </wsdl:port>
</wsdl:service>

XMLSpy says that the wsdl is valid but it fails when i try to create the web service from it. Any help would be appreciated even constructive criticism.

EDIT

Using wsimport from the commmand line I get.

[ERROR] Invalid wsdl:operation "RequestQuote": its a rpc-literal operation, mes sage part must refer to a schema type declaration line 16 of file:/D:/projects/DICACORD/QuoteRq2.wsdl

Does that mean that even though the two xsd's are imported I still have to define the types in the wsdl?

Update 2

The schema for the request->. Schema at pastie

Addition

Does anyone see anything wrong with the xsd imports and/or how they are being used?

A: 

Easiest way to verify that wsdl is valid is to run from command line:

wsimport yourservice.wsdl

and see if it gives you any errors. wsimport comes with JDK 1.6

WSDL you submitted is not complete as it has references to external schema files (XSD) so there is no way for me to validate it.

maximdim
A: 

ACORD is in the namespace http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRq.xsd.

It seems to me that your import of ACORD is invalid, in that it is identifying ACORD's namespace differently:

<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRq.xsd"/>

Noel Ang
+1  A: 

To answer my own question, the reason the web service was failing to be created from the wsdl was due to the use ofwsdl:import instead of xs:import.

I didn't know it but after doing some more research it seems that wsdl:import should be used when you want to import another wsdl but if you want to import a schema from a to use the types defined in it within the wsdl you need to use an xsd:import because if not wsimport will not find the types defined in the schema.

I changed

xmlns:ns="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRq.xsd"
xmlns:na="http://discoveryinsurance.com/DicQuoteSvc/schemas/DicAcordQuoteRs.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"

to

xmlns:rq="http://discoveryinsurance.com/DicQuoteSvc/schemas/request/" 
xmlns:rs="http://discoveryinsurance.com/DicQuoteSvc/schemas/response/"

and changed the imports from

<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/"  location="DicAcordQuoteRq.xsd"/>
<wsdl:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/" location="DicAcordQuoteRs.xsd"/>

to

<xs:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/request/" schemaLocation="DicAcordQuoteRq.xsd"/>
<xs:import namespace="http://discoveryinsurance.com/DicQuoteSvc/schemas/response/" schemaLocation="DicAcordQuoteRs.xsd"/>

Making these changes allowed the web service to build successfully and the classes were created based off of the two schemas. Hopefully when I begin testing the web service on Monday it will work as I want it to. Thanks all of you for the input you provided as it led me to look into other reasons why the creation of the web service from the wsdl was failing.

I did change the namespace that they are in but that was for different reasons and I did that after the web service had been created and deployed locally on my machine.

Happy Holidays Everyone.

ChadNC