You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sameer Bombatkar <sa...@hotmail.com> on 2003/06/17 15:47:54 UTC

Problem with Java Client

I am trying to invoke a web-service that returns a String from my Java 
Client..
Here's the code snippet..

String endpoint = "http://workstation-12:7001/axis/wsdl/DbWebService.wsdl";
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setOperationStyle(org.apache.axis.enum.Style.WRAPPED);
    call.setOperationUse(org.apache.axis.enum.Use.LITERAL);
    call.setTargetEndpointAddress(new java.net.URL(endpoint));
    call.setOperationName(new QName("http://dbwebservice","getStockPrice"));
    call.addParameter(new 
javax.xml.namespace.QName("http://dbwebservice","ticker"), 
org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
    call.setReturnType(org.apache.axis.Constants.XSD_STRING);
    String ret = (String) call.invoke(new Object[]{ticker});
    out.println(ret);

Here's the genarated wsdl which invokes the method OKAY when tried from 
other clients like .NET

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions 
targetNamespace="http://workstation-12:7001/axis/services/DbWebService" 
xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="http://workstation-12:7001/axis/services/DbWebService" 
xmlns:intf="http://workstation-12:7001/axis/services/DbWebService" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:message name="getStockPriceRequest">
  <wsdl:part name="in0" type="xsd:string" />
  </wsdl:message>
- <wsdl:message name="getStockPriceResponse">
  <wsdl:part name="getStockPriceReturn" type="xsd:string" />
  </wsdl:message>
- <wsdl:portType name="TestDbWebService">
- <wsdl:operation name="getStockPrice" parameterOrder="in0">
  <wsdl:input message="intf:getStockPriceRequest" 
name="getStockPriceRequest" />
  <wsdl:output message="intf:getStockPriceResponse" 
name="getStockPriceResponse" />
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="DbWebServiceSoapBinding" type="intf:TestDbWebService">
  <wsdlsoap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getStockPrice">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getStockPriceRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://dbwebservice" use="encoded" />
  </wsdl:input>
- <wsdl:output name="getStockPriceResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://workstation-12:7001/axis/services/DbWebService" 
use="encoded" />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="TestDbWebServiceService">
- <wsdl:port binding="intf:DbWebServiceSoapBinding" name="DbWebService">
  <wsdlsoap:address 
location="http://workstation-12:7001/axis/services/DbWebService" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>


But with the above java client I'm getting the following error stack....

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Bad envelope tag:  definitions
faultActor:
faultNode:
faultDetail:
        {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: 
Bad envelope tag:  definitions
        at 
org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:109)

Where I am going wrong here... I think in my client this exception is 
generated when I am setting the Operation Names and Params --

call.setOperationName(new QName("http://dbwebservice","getStockPrice"));
call.addParameter(new 
javax.xml.namespace.QName("http://dbwebservice","ticker"),

any ideas??

Sameer.

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail