Results 1 to 4 of 4
  1. #1
    cfacile666 is offline Member
    Join Date
    Mar 2008
    Posts
    2
    Rep Power
    0

    Smile 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

  2. #2
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Default

    does anyone got this one right..

  3. #3
    ijkl521 is offline Member
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Question 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.

  4. #4
    thusa is offline Member
    Join Date
    Jul 2008
    Posts
    19
    Rep Power
    0

    Default

    Can you try the following?

    Service service = new Service(serviceQName);

    instead of

    Service service = new Service();

Similar Threads

  1. Accessing Data from a .txt file
    By Oasis13 in forum New To Java
    Replies: 5
    Last Post: 02-01-2008, 12:16 AM
  2. Writing webservice client
    By javaplus in forum Web Frameworks
    Replies: 0
    Last Post: 12-19-2007, 10:10 AM
  3. Accessing client file system
    By revathi17 in forum New To Java
    Replies: 1
    Last Post: 10-17-2007, 10:17 AM
  4. Webservice ain't working?
    By marcelman in forum Networking
    Replies: 0
    Last Post: 08-10-2007, 02:48 AM
  5. Packaging and accessing data files
    By todd in forum Advanced Java
    Replies: 1
    Last Post: 08-01-2007, 12:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •