wood burning stoves 2.0*
The moose likes Web Services and the fly likes WSDL issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSDL issues" Watch "WSDL issues" New topic
Author

WSDL issues

Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
I have a wsdl that I just want to send a 2 parameters(invoiceID and invoiceNumber). When I use the WSDLtoJava tool, it generates the java fine. When I view the service in Axis, it gives me a ton of methods. Looks like: I should just say getPurchaseOrder. See my WSDL below. Please help...

PurchaseOrder (wsdl)
getPurchaseOrderAddress
getPurchaseOrder
getPurchaseOrder
getPort
getPort etc.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://jstc1364:8080/axis/services/PurchaseOrder" xmlns:impl="http://jstc1364:8080/axis/services/PurchaseOrder" xmlns:intf="http://jstc1364:8080/axis/services/PurchaseOrder" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Created using Cape Clear Studio SOA Editor - http://www.capeclear.com</wsdl:documentation>
<wsdl:message name="PurchaseOrderRequest">
<wsdl:part name="invoiceID" type="xsd:integer"/>
<wsdl:part name="invoiceNumber" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="PurchaseOrderResponse">
<wsdl:part name="invoiceIDReturn" type="xsd:integer" />
<wsdl:part name="invoiceNumberReturn" type="xsd:integer" />
</wsdl:message>
<wsdl:portType name="PurchaseOrder">
<wsdlperation name="GetPurchaseOrders">
<wsdl:input name="PurchaseOrderRequest" message="impl:PurchaseOrderRequest"/>
<wsdlutput name="PurchaseOrderResponse" message="impl:PurchaseOrderResponse"/>
</wsdlperation>
</wsdl:portType>
<wsdl:binding name="PurchaseOrderBinding" type="impl:PurchaseOrder">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdlperation name="GetPurchaseOrders">
<wsdlsoapperation
soapAction=""/>
<!-- <wsdl:input>
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdlutput>
<wsdlsoap:body use="literal"/>
</wsdlutput>-->
<wsdl:input name="PurchaseOrderRequest">
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://purchaseOrder" />
</wsdl:input>
- <wsdlutput name="PurchaseOrderResponse">
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/PurchaseOrder" />
</wsdlutput>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="PurchaseOrder">
<wsdl:port binding="impl:PurchaseOrderBinding" name="PurchaseOrder">
<wsdlsoap:address location="http://jstc1364:8080/axis/services/PurchaseOrder"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42367
    
  64
If you think that that's what you ought to do, then why don't you? That is to say: is there a question somewhere in your post?


Ping & DNS - my free Android networking tools app
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
I meant to say in my post.. I want it to just say getPurchaseOrder instead of all the other methods. What I am doing wrong because I get all those other methods when I access my webservices in AXIS?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42367
    
  64
The methods that are exposed as WS are specified in the deployment descriptor. You should be able simply to remove the corresponding <operation> elements in your WSDD file, and then, after the next deployment, they should no longer be in the WSDL.
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
OK. I fixed the WSDL and it does work and I can deploy it, but I can't get a SOAP response. I get:
<faultstring>java.lang.InstantiationException:
localhost.axis.services.PurchaseOrderService.PurchaseOrder</faultstring>

I also see this error in my XML:

SeverityDescriptionResourceIn FolderLocationCreation TimeId
2cvc-complex-type.2.4.a: Invalid content was found starting with element 'types'. One of '{"http://schemas.xmlsoap.org/wsdl/" ocumentation, WC[##other:"http://schemas.xmlsoap.org/wsdl/"], "http://schemas.xmlsoap.org/wsdl/":import, "http://schemas.xmlsoap.org/wsdl/":types, "http://schemas.xmlsoap.org/wsdl/":message, "http://schemas.xmlsoap.org/wsdl/" ortType, "http://schemas.xmlsoap.org/wsdl/":binding, "http://schemas.xmlsoap.org/wsdl/":service}' is expected.
@see: http://www.w3.org/TR/xmlschema-1/#cvc-complex-typepurchaseOrder.wsdlaxisline 4November 5, 2005 4:47:55 PM1483

Can someone give me a idea of what might be wrong? Thanks
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
My WSDL:
<?xml version="1.0"?>
<wsdl efinitions targetNamespace="http://localhost:8080/axis/services/PurchaseOrderService" xmlns:typens="http://localhost:8080/axis/services/PurchaseOrderService" xmlns:impl="http://localhost:8080/axis/services/PurchaseOrderService" xmlns:intf="http://localhost:8080/axis/services/PurchaseOrderService" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost:8080/axis/services/PurchaseOrderService" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xsd:complexType name="PurchaseOrderResult">
<xsd:all>
<xsd:element name="purchaseOrderID" type="xsd:integer"/>
<xsd:element name="invoiceNumber" type="xsd:string"/>
<xsd:element name="first"/>
<xsd:element name="last"/>
<xsd:element name="address"/>
<xsd:element name="city"/>
<xsd:element name="zip"/>
<xsd:element name="country"/>
<xsd:element name="invoiceDate" type="xsd:string"/>
<xsd:element name="discount" type="xsd:string"/>
<xsd:element name="shipTo" type="xsd:string"/>
<xsd:element name="billTo" type="xsd:string"/>
<xsd:element name="lineItemID" type="xsd:string"/>
<xsd:element name="quanitity" type="xsd:string"/>
<xsd:element name="unitCost" type="xsd:string"/>
<xsd:element name="comments" type="xsd:string"/>
<xsd:element name="tax" type="xsd:string"/>
<xsd:element name="totalCost" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>

<wsdl:message name="PurchaseOrderRequest">
<wsdl :p art name="invoiceID" type="xsd:integer"/>
</wsdl:message>
<wsdl:message name="PurchaseOrderResponse">
<wsdl :p art name="return" type="typens :p urchaseOrderResult" />
</wsdl:message>

<wsdl :p ortType name="PurchaseOrder">
<wsdl peration name="GetPurchaseOrders">
<wsdl:input name="PurchaseOrderRequest" message="impl :p urchaseOrderRequest"/>
<wsdl utput name="PurchaseOrderResponse" message="impl :p urchaseOrderResponse"/>
</wsdl peration>
</wsdl :p ortType>

<wsdl:binding name="PurchaseOrderSoapBinding" type="impl :p urchaseOrder">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl peration name="GetPurchaseOrders">
<wsdlsoap peration soapAction=""/>
<wsdl:input name="PurchaseOrderRequest">
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://purchaseorder" />
</wsdl:input>
<wsdl utput name="PurchaseOrderResponse">
<wsdlsoap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/PurchaseOrder" />
</wsdl utput>
</wsdl peration>
</wsdl:binding>

<wsdl:service name="PurchaseOrderService">
<wsdl :p ort binding="impl :p urchaseOrderSoapBinding" name="PurchaseOrder">
<wsdlsoap:address location="http://localhost:8080/axis/services/PurchaseOrderService"/>
</wsdl :p ort>
</wsdl:service>
</wsdl efinitions>
[ November 05, 2005: Message edited by: Matt Hoffman ]
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
The reason for my previous error is that <types> should be <wsdl:types>. Now I am not sure how to invoke this and get a SOAP response. This is the request, but I get a java.lang.InstantiationException. What do I need to do to get a response?

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<oxy:GetPurchaseOrders xmlnsxy="http://purchaseorder">
<invoiceID>1111</invoiceID>
</oxy:GetPurchaseOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42367
    
  64
How is this request created - did you put it together manually? (I ask because, not seeing the client code, and not knowing where the exception is thrown, I assume that the SOAP is incorrect, although there can be other reasons.). An API like SAAJ can help with only a few lines of code; this article shows how.
[ November 06, 2005: Message edited by: Ulf Dittmer ]
Matt Hoffman
Ranch Hand

Joined: Jun 03, 2004
Posts: 83
Thanks for the reply. I am getting the exception when sending the soap request. I guess this is my question. I am not using a DB or anyhing. I just need to send a request that sends a invoiceID and receives header and line item info for 1 invoice. I would be passing the invoiceID via a client in the command line and then getting a SOAP request and response. THis seems so simple, but I am getting this in the response. Any ideas you may have will be helpful on how to do a "static" request and response.

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.InstantiationException:
localhost.axis.services.PurchaseOrderService.PurchaseOrder</faultstring>
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">JSTC1364</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSDL issues