Advertisement

05.12.2008 at 03:02PM PDT, ID: 23396120
[x]
Attachment Details

SOAP client with AXIS having trouble hitting .NET Based SOAP Servers

Asked by mhp2007 in SOAP, Java Programming Language, Extensible Markup Language (XML)

Tags: Apache, AXIS, 1.4

I'm having trouble getting a quote back from my simple example that i've created for myself. I keep getting: "Sent 'MSFT', got 'exception'" back from the server. As you can see from my xml below in the code space, and from the getQuote documentation it appears that the namespace is not correct on Symbol and GetQuote in my request. I cant think of much else that would be wrong with this....

Basically, I want to simply get a quote back from webservicesx.net using the GetQuote Operation: http://www.webservicex.net/stockquote.asmx?op=GetQuote


Here's what my actual (captured) xml looks like (below):

My actual code:
<code>
 try {
               String endpoint =  "http://www.webservicex.net/stockquote.asmx";

               Service  service = new Service();

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

               //call.setProperty( Call.SOAPACTION_USE_PROPERTY, new Boolean( true ) );

              // call.setProperty( Call.SOAPACTION_URI_PROPERTY, "http://www.webserviceX.NET/GetQuote");

               call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
               call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://www.webserviceX.NET/GetQuote");
               call.setReturnType(XMLType.XSD_STRING);
               
               call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);

               call.setTargetEndpointAddress( new java.net.URL(endpoint) );

               call.setOperationName(new QName( "GetQuote") );


               Object obj = call.invoke( new Object[] { "MSFT" } );

               System.out.println("Sent 'MSFT', got '" + obj + "'");

        } catch (Exception e) {

               System.err.println(e.toString());

               e.printStackTrace();

       }
</code>


Thanks in advance.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
<?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>
                <GetQuote soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                      <symbol xsi:type="xsd:string">MSFT</symbol>
                </GetQuote>
          </soapenv:Body>
     </soapenv:Envelope>
[+][-]05.12.2008 at 07:07PM PDT, ID: 21551786

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SOAP, Java Programming Language, Extensible Markup Language (XML)
Tags: Apache, AXIS, 1.4
Sign Up Now!
Solution Provided By: shivaspk
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.12.2008 at 08:35PM PDT, ID: 21552120

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 03:26AM PDT, ID: 21553605

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628