• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Problem with Java Client

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to invoke a web-service that returns a String to 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??
Sam
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sam Bom:
I am trying to invoke a web-service that returns a String to 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));
Sam


Isn't that your endpoint shd point to "http://workstation-12:7001/axis/services/DbWebService"
 
Sam Bom
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right...Thanks..
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I�m getting a �Bad Envelope Tag: Definitions� error when I try calling the webservice from my client. Any thoughts/suggestions on this is highly appreciated.

Thanks,
Cyril

Error Stack Trace

stackTrace: org.xml.sax.SAXException: Bad envelope tag: definitions
at org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:107)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:906)
at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1284)
at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1806)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:949)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:232)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:546)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
at org.apache.axis.client.Call.invokeEngine(Call.java:2132)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at com.wamu.p2p.rms.URSA_XML_Receiver.URSA2_P2P_ReceiverSoapBindingStub.opCreate(URSA2_P2P_ReceiverSoapBindingStub.java:210)
at com.wamu.p2p.rms.ConnectReceiverTester.main(ConnectReceiverTester.java:147)
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The endpoint --> url + resource (http://localhost/axis/services/price)
 
Hey! You're stepping on my hand! Help me tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic