• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Currency Web Service almost there

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i created all the necessary stubs using apache axis for the webservice. i wrote a client, the code is listed below. The WSDL for the web service can be found at http://www.webservicex.net/CurrencyConvertor.asmx?WSDL.
i got the soap address and registered the QName. Could you please let me know where i am going wrong

Here is my code

public void startCCConvert(){
CurrencyConvertorLocator cclocator =new CurrencyConvertorLocator();
String ccsoapAddress = cclocator.getCurrencyConvertorSoapAddress();
System.out.println("SOAP ADDRESS LOCATION : " + ccsoapAddress );
try{
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL (ccsoapAddress));
call.setOperationName("http://www.webserviceX.NET/ConversionRate");
QName ConversionRate = new QName ("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", "Currency");
NET.webserviceX.www.Currency FromCurrency = NET.webserviceX.www.Currency.USD;
NET.webserviceX.www.Currency ToCurrency = NET.webserviceX.www.Currency.INR;


call.addParameter("FromCurrency",ConversionRate,ParameterMode.IN);
call.addParameter("ToCurrency",ConversionRate,ParameterMode.IN);
call.setReturnType(XMLType.XSD_DOUBLE);
Double ret = (Double) call.invoke(new Object [] {FromCurrency,ToCurrency});
}catch (MalformedURLException e ){
e.printStackTrace();
}catch (RemoteException e){
e.printStackTrace();
}catch (ServiceException e){
e.printStackTrace();
}
}

Here is my stack trace
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.test.wsclient.CCClient.startCCConvert(CCClient.java:54)
at com.test.wsclient.CCClient.main(CCClient.java:26)

{http://xml.apache.org/axis/}hostname:Rnizamuddin-745

System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: .
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.test.wsclient.CCClient.startCCConvert(CCClient.java:54)
at com.test.wsclient.CCClient.main(CCClient.java:26)
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello any body has some idea.

Thanks
Rashid
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given this error:


My first step would be to use TCPMON to capture the complete SOAP request with headers to see what is actually being written for SOAPaction.

Bill
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks William

i cant intercept with the tcpmon utility coz the webservice which i am using is not located on my local machine. its written in .net and hosted remotely. i have some webservice installed on my local tomcat apache axis directoy and all my webservice client hit port 8081 and the tcpmon redirects them to localhost@ 8080. Anyway i was able to call this webservice from .net and jdeveloper since they do most of the dirty work of implementation. i just need a way on how to pass my custom object usign beanserializer. if you have any tutorial on that please let me know
here is my code
try{




Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(new java.net.URL ("http://www.webservicex.net/CurrencyConvertor.asmx"));
//call.setOperationName("conversionRate");
call.setOperationName(new QName("http://www.webservicex.net/CurrencyConvertor.asmx", "conversionRate"));
QName cRate = new QName("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", "ConversionRate");
//QName ConversionRateResponse = new QName("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL", "double");
ConversionRate convRate = new ConversionRate();
convRate.setToCurrency(dotnet.Currency.INR);
convRate.setFromCurrency(dotnet.Currency.USD);


call.addParameter("convRate",cRate,ParameterMode.IN);
call.setReturnType(XMLType.XSD_DOUBLE);
Object ret = call.invoke(new Object [] {convRate});
}catch (MalformedURLException e ){
e.printStackTrace();
}catch (RemoteException e){
e.printStackTrace();
}catch (ServiceException e){
e.printStackTrace();
}
Thanks
Rashid
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i cant intercept with the tcpmon utility coz the webservice which i am using is not located on my local machine. its written in .net and hosted remotely. i have some webservice installed on my local tomcat apache axis directoy and all my webservice client hit port 8081 and the tcpmon redirects them to localhost@ 8080.[/QB]



tcpmon is perfectly capable of redirecting to a remote host - that's what the "Target Hostname" field is for.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic