Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-06-2008, 12:31 PM
Member
 
Join Date: Mar 2008
Posts: 2
cfacile666 is on a distinguished road
Axis Client accessing data on .Net webservice
Hi All,

I am trying to access data on http://www.webserviceX.NET/stockquote.asmx?WSDL using an Axis client.

the proble is that the message/xml/rpc(?) my requests send to the network is not what the webservice expects.

The website wants (discovered with StrikeIron Analyzer and WireShark)

***********************
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding">
<soap:Body>
<tns:GetQuote
xmlns:tns="http://www.webserviceX.NET/">
<tns:symbol>
GOOG
</tns:symbol>
</tns:GetQuote>
</soap:Body>
</soap:Envelope>
***********************

and my Axis Client sends

***********************
<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>
<GetQuote
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<symbol
xsi:type="xsd:string">
GOOG
</symbol>
</GetQuote>
</soapenv:Body>
</soapenv:Envelope>

***********************

I cannot figure out what parameter I should change in my code so that my request is sent properly.

Here is the code:
##################code start####################
logDebug("Debut Fonction");
String wsdlLoc ="http://www.webservicex.net/stockquote.asmx?WSDL";
String endpoint="http://www.webservicex.net/stockquote.asmx";
String namespace="http://www.webserviceX.NET/";//dontchange
String serviceName="StockQuote";
String symbol2="GOOG";
logDebug("Param Fonction OK");
QName serviceQName= new QName(namespace,serviceName);
QName portQName= new QName(namespace,"StockQuote");
QName operationQName= new QName(namespace,"http://www.webserviceX.NET/GetQuote");
logDebug("Before Try : ");
try {
logDebug("B4 Service ");
// Service service = new Service(wsdlLoc, serviceQName);

//****************
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
call.setTimeout(30000);
call.setSOAPActionURI("http://www.webserviceX.NET/GetQuote");
call.setUseSOAPAction(true);
call.setOperationUse("literal");
call.setOperationName("GetQuote");
call.setOperationStyle("rpc");
//call.addParameter(new javax.xml.namespace.QName("http://tempuri.org/upload/", "symbol"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN);

call.addParameter("symbol",XMLType.XSD_STRING,Para meterMode.IN);
call.addParameter("GetQuoteResult", XMLType.XSD_STRING,ParameterMode.OUT);

String quote = (String) call.invoke("GetQuote",new Object[] {symbol2});
// String quote = (String) call.invoke("getVersion", new Object[] {new String("IBM")});



//String quote= (String) call.invoke(symbol);
logDebug("Call QuoteOK ");
logDebug("Quote==>>"+ quote.substring(0,5));


/*
logDebug("B4 Call ");
Call call = (Call) service.createCall();
call.setPortTypeName(portQName);
call.setTargetEndpointAddress(endpoint);
logDebug("B4 setOperation ");
call.setOperationName(operationQName);
logDebug("B4 quote=call.invoke ");
String quote= (String) call.invoke(new Object[] {symbol});*/
return quote;
} catch(Exception ex) {
logError("Error getting quote",ex);
}
return "error";

################################################## #

This code connects to the remote web server, send the request, but because of the wrong markups, thinks the input stock symbol (GOOG) is null and return a value = "exception" instead of xml answer.

If somebody has some tips on what parameter to change in my code, that would be fabulous !!

Cheers

Seb
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-11-2008, 02:02 PM
Member
 
Join Date: Jun 2008
Posts: 1
prashanthsubhash is on a distinguished road
does anyone got this one right..
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-24-2008, 12:09 PM
Member
 
Join Date: Jun 2008
Posts: 1
ijkl521 is on a distinguished road
15
Once we grew tired of the water we lay on the beach and I was blown away by what I saw and it wasn’t nature.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Data from a .txt file Oasis13 New To Java 5 02-01-2008 01:16 AM
Writing webservice client javaplus Web Frameworks 0 12-19-2007 11:10 AM
Accessing client file system revathi17 New To Java 1 10-17-2007 11:17 AM
Webservice ain't working? marcelman Networking 0 08-10-2007 03:48 AM
Packaging and accessing data files todd Advanced Java 1 08-01-2007 01:27 AM


All times are GMT +3. The time now is 01:26 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org