Use WSDL to call Webservice

Guys, I am on 6.20
I read through the documentation on some related topics but still don't have a clear idea of how to proceed.
I have a WSDL provided to me. I need to use this and call the Webservice from my BSP.
I have seen examples where SOAP message is hardcoded and tried to do similar using information for mWSDL but am getting a HTTP comm. failure?
Whats the preferable method to use WSDL and call the webservice in 6.20.?
Do I have to create a XSLT program to parse a WSDL and provide something which  I could then use to make the call?
Appreciate it..
Thanks.

Look at the below thread to consume webservice..
Re: Consuming WebService, + SOAP HEADER AUTH:
<i>Do I have to create a XSLT program to parse a WSDL and provide something which I could then use to make the call?</i>
Yes, to translate from XML to ABAP you can use XSLT.
To know <b>more about XSLT</b> check the below links:
reference link:
http://help.sap.com/saphelp_nw04/helpdata/en/fd/9d7348389211d596a200a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/bb/576670dca511d4990b00508b6b8b11/content.htm
Upload XML to internal table and vice versa in SAP 4.6C
/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
<i>*Reward each useful answer</i>
Raja T
Message was edited by:
        Raja Thangamani

Similar Messages

  • Why should we use WSDL for developing webservices

    I need to develop Webservice Application for our Client .
    I dont know anything about WSDL4J
    Hi from the net i found this
    "The Web Services Description Language for Java Toolkit (WSDL4J) allows the creation, representation, and manipulation of WSDL documents.
    Is the reference implementation for JSR110 'JWSDL' (jcp.org)."
    But anybody please tell me why should we use WSDL for developing webservices ??
    Is there any specific advantage we will get ??
    And Can body please point me a link where to start for working with WSDL4j ?
    Thank you very much

    i seriously doubt you want to use wsdl4j unless you are doing really advanced webservice work. assuming you are developing this webservice from scratch, you basically want to use JAXWS: define an appropriate interface and your value classes, and let JAXWS do the rest. metro is the JAXWS implementation included in the oracle jdk and it has great tutorials and reference documentation online. i'd suggest you start here: http://metro.java.net/getting-started/

  • How to use a WSDL file to call webservice? Help!

    Hi Experts,
         I have exposed a SAP function module as webservice using the
         Utilities -> More Utilities -> Create Web Service -> From Function module
         What does this step actually does? Does it create some kind of web application like BSP for the function module in the background?
         After creating the web service I have released the service definition for the SOAP runtime using the transaction WSCONFIG.
        Finally I have generated the WDSL file ofr the webservice using WSADMIN transaction.
        After this how will my third party application like Java will use the WSDL? Will I need any connector software to be installed in Java side.
        How exactly will java call my webservice using WSDL?
        What actually happens or what is the message flow when java application calls by webservice?
        Kindly help.
    Thanks
    Gopal

    Hi, Your solution should be correct and it's a quite common approach for Login authentication.Informatica's webservice provider also need 2 steps for calling its webservice1. Getting the session ID using username and password 2. Use the session ID to call any active operation 3. Use the session ID to log out if webservice do not have any time out settings for each session. SOAP standard is listed in the WSDL of saleforce webservice. It affects if you cannot find/call any operation in PowerCenter level. My lastest information is for PWC 9.1 version only, I don't know if they have enhanced this function in 9.5. If you can call the operation, you can just put it (SOAP standard) way first. Regards,Felix

  • Call Webservice using REST and not SOAP

    Hi, I am looking for an example of calling (invoking) a webservice from the database using PLSQL. The webservice is using REST rather than SOAP and returning XML
    I have already got examples of how to call a webservice using SOAP but not for REST
    Regards
    Ash

    Using Fiddler while loading your WSDL in a browser, I can see that the WSDL is using HTTP Chunked encoding. You should configure JBoss to return the WSDL without chunked encoding.

  • How to call webservice using jdev9i

    Hi gurus and experts,
    i need to consume a webservice using oaf. with great effort finally i created stub using axis s/w.
    now i dont know how to use the stub in jdev.where to write the code and what to write.iam strucked :-( .
    since there were no sample tutorial about how to call webservice from jdev9i, iam struggling to make.iam jus a starter.
    and while googling i came to know that stubs can be created using jdev9i .but when i see new-->webservices--web service stub it is greyed out.
    i have 2 questions now:
    1)if stub created using axis can it be used in jdev9i? if yes ,please tell me how? any tutorial links also helps me.
    2)if the stubs should be created only by jdev9i so that webservices can be called using jdev,then please guide me how to make it.
    i need some helping hands from u guys.
    Thanks a lot
    Edited by: 881533 on Oct 25, 2011 2:34 AM
    Edited by: 881533 on Oct 25, 2011 2:37 AM

    Hello sir,
    i got following reply:
    <returnRecordResponse  xmlns="http://xyz" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <returnResult>Error_request</returnResult>
    </returnRecordResponse>
    but correct response is
    <returnRecordResponse  xmlns="http://xyz" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <returnResult>Success</returnResult>
    </returnRecordResponse>
    can you tell me correction in the code which i have put on the forum?or tell me other way to call webservice?

  • How to call webservice using flex?

    Hello,
    i want to call webservice in flex.i tryied following code.but it is not giving correct response.what is wrong with this code?
    can anybody tell me ,how to call webservice in flex?
    Code:
    <mx:Script>
            <![CDATA[
    public function button1_clickHandler(event):void
         ws.returnRecord(para1,para2);//i am sending two parameter to returnRecord service here
    public function remotingCFCHandler(event:ResultEvent):void
    trace(event.result);
    ]]>
    </mx:Script>
    <mx:WebService
         id="ws"
         wsdl="http://localhost:8500/flexapp/returnusers.cfc?wsdl">
        <mx:operation name="returnRecords" resultFormat="object"
         fault="mx.controls.Alert.show(event.fault.faultString)"
         result="remotingCFCHandler(event)"/>
    <mx:Button label="Go" fontWeight="bold" click="button1_clickHandler(event)"/>

    Hello sir,
    i got following reply:
    <returnRecordResponse  xmlns="http://xyz" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <returnResult>Error_request</returnResult>
    </returnRecordResponse>
    but correct response is
    <returnRecordResponse  xmlns="http://xyz" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <returnResult>Success</returnResult>
    </returnRecordResponse>
    can you tell me correction in the code which i have put on the forum?or tell me other way to call webservice?

  • How to call webservice for each record in a table using ODI

    Hi
    I am new to ODI and Webservice. I want to invoke a scenario in ODI using web service. I hava a weblogic application server with axis 2 deployed.
    But I want call webservice for each record in a table
    For eg: "EMP" table have 50 records, for each record web service should invoke
    Can any one help me on it.
    Thanks,
    phani
    Edited by: user12774166 on Jun 6, 2010 11:16 PM

    If your goal is "call" a web service, Jason's Straub's [flex-ws-api|https://flex-ws-api.samplecode.oracle.com/] is by far the best I've seen. You might want read more about it on [his blog|http://jastraub.blogspot.com/search?q=+flex_ws_api+].
    Tyler Muth
    http://tylermuth.wordpress.com
    [Applied Oracle Security: Developing Secure Database and Middleware Environments|http://sn.im/aos.book]

  • Problem in calling webservice using https from livecycle designer

    I  want to call a webservice written in .net(c#) using https  from livecycle  designer.I can call webservice using http ,but when i try with https it is  failing.If there any special configuration have to do in server for this ?I have  already put crossdomain in server.
    Waiting  for your reply
    thank's

    How did you call from LC? Please help me out either one is fine to me http or https
    Srujan

  • Webservice controls using WSDL in weblogic portal10.3.2

    Hi All
    How to create and use Webservice controls using WSDL in weblogic portal10.3.2 ? Is that possible ? If no, is there any other easy way to implement the same ?
    thanx
    developer

    This document should help.
    http://download.oracle.com/docs/cd/E15315_03/help/oracle.eclipse.tools.weblogic.doc/html/webservices/start.html
    Brad

  • Cannot pass parameter to webservice using wsdl

    cannot pass parameter to webservice using wsdl
    I write code the following:
    step 1
    -->
    DECLARE
    SERVLET_NAME VARCHAR2(32) := 'orawsv';
    BEGIN
    DBMS_XDB.deleteServletMapping(SERVLET_NAME);
    DBMS_XDB.deleteServlet(SERVLET_NAME);
    DBMS_XDB.addServlet(NAME => SERVLET_NAME,
    LANGUAGE => 'C',
    DISPNAME => 'Oracle Query Web Service',
    DESCRIPT => 'Servlet for issuing queries as a Web Service',
    SCHEMA => 'XDB');
    DBMS_XDB.addServletSecRole(SERVNAME => SERVLET_NAME,
    ROLENAME => 'XDB_WEBSERVICES',
    ROLELINK => 'XDB_WEBSERVICES');
    DBMS_XDB.addServletMapping(PATTERN => '/orawsv/*',
    NAME => SERVLET_NAME);
    END;
    step 2
    --> CREATE USER test IDENTIFIED BY test QUOTA UNLIMITED ON users;
    step 3
    --> GRANT CONNECT,CREATE TABLE, CREATE PROCEDURE TO test;
    step 4
    --> GRANT XDB_WEBSERVICES TO test
    step 5
    --> GRANT XDB_WEBSERVICES_OVER_HTTP TO test
    step 6
    --> GRANT XDB_WEBSERVICES_WITH_PUBLIC TO test
    step 7
    -->
    SELECT dbms_xdb.getftpport() FROM dual;
    SELECT dbms_xdb.gethttpport() FROM dual;
    exec dbms_xdb.setHttpPort(8080);
    exec dbms_xdb.setFtpPort(2100);
    step 8
    -- Double check
    host lsnrctl STATUS
    SET head off
    -- Valid?
    SELECT * FROM dba_registry WHERE comp_id='XDB';
    SET head ON
    connect test/test;
    CREATE OR REPLACE FUNCTION FACTORIAL_I(N PLS_INTEGER)
    RETURN PLS_INTEGER
    IS
    n_result number;
    BEGIN
    IF N > 1 THEN
    n_result := N * FACTORIAL_I(N - 1);
    RETURN(n_result);
    ELSE
    RETURN(1);
    END IF;
    END;
    WSDL Output:
    http://localhost:8080/orawsv/TEST/FACTORIAL_I?wsdl
    output picture: http://www.picza.net/show.php?id=20120429vlxdlFdvFPdvF134795
    I try pass prameter by http://localhost:8080/orawsv/TEST/FACTORIAL_I?SBINARY_INTEGER-FACTORIAL_IInput=5
    but error <ErrorNumber>ORA-31011</ErrorNumber>
    Edited by: 930927 on 29 เม.ย. 2555, 9:02 น.

    Using something like SoapUI or do it via PL/SQL as shown here: Re: Ora-31011 with a very, very simple native webservice

  • Calling webservice in code using data control ADF Mobile

    Hi,
    I am calling webservice in code using data control. Below image is show my binding.
    https://www.dropbox.com/s/ufjnnd67mfaeucq/Snap%202013-05-13%20at%2011.49.17.png
    My code is :
    ValueExpression ve1 = AdfmfJavaUtilities.getValueExpression("#{bindings.WeatherDescriptionIterator}", AmxIteratorBinding.class); // Using IteratorBinding
    AmxIteratorBinding iter = (AmxIteratorBinding) ve1.getValue(AdfmfJavaUtilities.getAdfELContext());
    GenericType row = null;
    iter.getIterator().first();
    iter.release();
    for(int i = 0; i < iter.getIterator().getTotalRowCount(); i++)
    row = (GenericType)iter.getCurrentRow();
    Integer s = new Integer(i+100);
    row.setAttribute("deptId", s);
    This code is work fine in POJO data control. But When I used this code for calling webservice data control then i get following error.
    can not find property bindings.
    And I also use below code but same error occur.
    ValueExpression ve1l = AdfmfJavaUtilities.getValueExpression("#{bindings.WeatherDescription.collectionModel}", AmxCollectionModel.class); // Using CollectionModel
    AmxCollectionModel model = (AmxCollectionModel)ve1l.getValue(AdfmfJavaUtilities.getAdfELContext());
    Object[] myArr = model.getKeys();
    for (int x = 0; x < myArr.length; x++)
    Object myObj = myArr[x];
    Map provider = (Map)model.getProviders().get(myObj);
    String deptName = provider.get("deptName").toString();
    }

    !!!! IMPORTANT !!!!
    The use of +*#{data.view_FlexFieldDisplayPageDef.publicflexfieldflow1.regionModel}"*+ in your code is an *absolute no-go and serious coding issue* as there is no guarantee that this PageDef file exists in the application you use the declarative component in. Even if you don't plan to use the declarative component anywhere else, you should pass the model reference as an input attribute to the declarative component so it can be configured by each use of the component
    Frank

  • How to show busy cursor  when call webservice using as?

    I want to call webservice using script,but i don't know how
    to show busy cursor.please help me

    Show busy cursor:
    >>>
    CursorManager.setBusyCursor();
    <<<
    and hide it:
    >>>
    CursorManager.removeBusyCursor();
    <<<
    Don't forget to catch all events of the web-service to
    securely remove the busy cursor. Especially, you might wish to
    handle events of the 'results received' and the 'faults appeared'
    logical results.

  • PHP using soap to call EJB

    Hello everybody,
    I've a problem to call a EJB form a PHP script.
    There is a Apache with PHP 5.2.0 and a SAP NetWeaver Application Server 7.10 / AS Java 7.10 running on the system.
    I wanted to use soap to call a method in an EJB. It's only a test EJB:
    [code]
    package beans;
    import javax.ejb.Stateless;
    import javax.jws.WebService;
    import javax.jws.WebMethod;
    @WebService(name="HelloWorldEARBean",serviceName="HelloWorldEARBeanService",targetNamespace="http://beans/",portName="HelloWorldEARBeanPort") @Stateless public class HelloWorldEARBean {
      @WebMethod public String sayHello(String testStr){
                return "Hello Mr. "+testStr;
      @WebMethod public String getReturn(String inputStr){
                return "the return value is"+inputStr;
    [/code]
    I tried it with the PEAR SOAP in the following script:
    [code]
    <?php
    require_once 'SOAP/Client.php';
    $wsdl_url     = 'http://localhost:50000/HelloWorldEARBeanService/HelloWorldEARBean?wsdl';
    $WSDL = new SOAP_WSDL($wsdl_url);
    $client = $WSDL->getProxy();
    $client->__trace(1);
    $options=array('namespace' => 'http://beans/',
      'style' => 'rpc',
      'soapaction' => 'sayHello');
    $NAME = "Bob"; 
    $parameters=array(
         'parameters', $NAME
    $result = $client->getReturn($parameters);
    echo "<pre>";
    print_r($params);
    echo "</pre>";
    echo "<h2>return</h2>";
    echo "<pre>";
    print_r($result);
    echo "</pre>";
    echo '<h2>Request</h2>';
    echo '<pre>' . htmlspecialchars($client->__getlastrequest(), ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2>';
    echo '<pre>' . htmlspecialchars($client->__getlastresponse(), ENT_QUOTES). '</pre>';
    ?>
    [/code]
    The AS distributes the following WSDL:
    [code]
    - <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://beans/" xmlns:tns="http://beans/">
    - <wsdl:types>
    - <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://beans/">
      <xs:element name="getReturn" type="tns:getReturn" />
      <xs:element name="getReturnResponse" type="tns:getReturnResponse" />
      <xs:element name="sayHello" type="tns:sayHello" />
      <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
    - <xs:complexType name="sayHello">
    - <xs:sequence>
      <xs:element name="arg0" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
    - <xs:complexType name="sayHelloResponse">
    - <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
    - <xs:complexType name="getReturn">
    - <xs:sequence>
      <xs:element name="arg0" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
    - <xs:complexType name="getReturnResponse">
    - <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
      </xs:schema>
      </wsdl:types>
    - <wsdl:message name="sayHelloIn">
      <wsdl:part name="parameters" element="tns:sayHello" />
      </wsdl:message>
    - <wsdl:message name="sayHelloOut">
      <wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse" />
      </wsdl:message>
    - <wsdl:message name="getReturnIn">
      <wsdl:part name="parameters" element="tns:getReturn" />
      </wsdl:message>
    - <wsdl:message name="getReturnOut">
      <wsdl:part name="getReturnResponse" element="tns:getReturnResponse" />
      </wsdl:message>
    - <wsdl:portType name="HelloWorldEARBean">
    - <wsdl:operation name="sayHello" parameterOrder="parameters">
      <wsdl:input message="tns:sayHelloIn" />
      <wsdl:output message="tns:sayHelloOut" />
      </wsdl:operation>
    - <wsdl:operation name="getReturn" parameterOrder="parameters">
      <wsdl:input message="tns:getReturnIn" />
      <wsdl:output message="tns:getReturnOut" />
      </wsdl:operation>
      </wsdl:portType>
    - <wsdl:binding name="HelloWorldEARBeanBinding" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" type="tns:HelloWorldEARBean">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="sayHello">
      <soap:operation soapAction="" />
    - <wsdl:input>
      <soap:body parts="parameters" use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
    - <wsdl:operation name="getReturn">
      <soap:operation soapAction="" />
    - <wsdl:input>
      <soap:body parts="parameters" use="literal" />
      </wsdl:input>
    - <wsdl:output>
      <soap:body use="literal" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="HelloWorldEARBeanService">
    - <wsdl:port name="HelloWorldEARBeanPort" binding="tns:HelloWorldEARBeanBinding">
      <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:50000/HelloWorldEARBeanService/HelloWorldEARBean" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>
    [/code]
    By the following output it's obvious that the AS or the EJB (webservice) doesn't receive the parameter send by the PHP script. Look at the output:
    return value:
    the return value is null
    [code]
    Request:
    POST /HelloWorldEARBeanService/HelloWorldEARBean HTTP/1.0
    User-Agent: PEAR-SOAP 0.8.0RC4-devel
    Host: localhost
    Content-Type: text/xml; charset=UTF-8
    Content-Length: 438
    SOAPAction: ""
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    >
    <SOAP-ENV:Body>
    <getReturn xmlns="http://beans/">
    <item>parameters</item>
    <item>Bob</item></getReturn>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Response:
    HTTP/1.1 200 OK
    server: SAP NetWeaver Application Server 7.10 / AS Java 7.10
    content-type: text/xml; charset=utf-8
    date: Wed, 14 Feb 2007 15:51:53 GMT
    connection: close
    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsu:Created>2007-02-14T15:51:53Z</wsu:Created>
    <wsu:Expires>2007-02-14T15:52:23Z</wsu:Expires></wsu:Timestamp></wsse:Security></SOAP-ENV:Header>
    <SOAP-ENV:Body><ns2:getReturnResponse xmlns:ns2='http://beans/'>
    <return>the return value is null</return></ns2:getReturnResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
    [/code]
    I used different soap interfaces for PHP like nusoap and the integrated soap interface of PHP 5.
    Further I experimented with different parameters inside the function call
    that results in small differencies at the xml-request.
    Thanks.

    Hi
    I've solved the problem now. I just have to add
    @SOAPBinding(style=SOAPBinding.Style.RPC)
    in the EJB, that's all.
    Here is the complete code, ... maybe some other guys have this problem too, so I will post the working code:
    At first the EJB:
    package beans;
    import javax.ejb.Stateless;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.jws.WebMethod;
    import javax.jws.soap.SOAPBinding;
    import beans.HelloWorldEARBean;
    @WebService(name="HelloWorldEARBean",serviceName="HelloWorldEARBeanService",targetNamespace="http://beans/",portName="HelloWorldEARBeanPort")
    @SOAPBinding(style=SOAPBinding.Style.RPC)
    @Stateless public class HelloWorldEARBean {
         @WebMethod public String sayHello(@WebParam(name="testStr") String testStr){
                return "Hello Mr. "+testStr;
    2. the local XML:
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://beans/" xmlns:tns="http://beans/">
      <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://beans/">
          <xs:element name="sayHello" type="tns:sayHello"/>
          <xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
          <xs:complexType name="sayHello">
              <xs:element name="testStr" type="xs:string" minOccurs="0"/>
          </xs:complexType>
          <xs:complexType name="sayHelloResponse">
              <xs:element name="return" type="xs:string" minOccurs="0"/>
          </xs:complexType>
        </xs:schema>
      </wsdl:types>
      <wsdl:message name="sayHelloIn">
        <wsdl:part name="parameters" element="tns:sayHello"/>
      </wsdl:message>
      <wsdl:message name="sayHelloOut">
        <wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse"/>
      </wsdl:message>
      <wsdl:portType name="HelloWorldEARBean">
        <wsdl:operation name="sayHello" parameterOrder="parameters">
          <wsdl:input message="tns:sayHelloIn"/>
          <wsdl:output message="tns:sayHelloOut"/>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="HelloWorldEARBeanBinding" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" type="tns:HelloWorldEARBean">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sayHello">
          <soap:operation soapAction=""/>
          <wsdl:input>
            <soap:body parts="parameters" use="literal"/>
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="HelloWorldEARBeanService">
        <wsdl:port name="HelloWorldEARBeanPort" binding="tns:HelloWorldEARBeanBinding">
          <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:50000/HelloWorldEARBeanService/HelloWorldEARBean"/>
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
    3. the PHP script:
    see next post
    Thank you very much for your help.

  • Error when call webservice on servlet

    Hi All,
    I'm having a problem when calling webservice inside the servlet on the WebLogic environment.
    My code:
    * Webservice:
    package ws;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Date;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    @WebService
    public class getData {
    public getData() {
    super();
    @WebMethod
    public String getHello() {
    return "HELLO HELLO";
    private Connection getConn() throws NamingException, SQLException {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource)ic.lookup("jdbc/hnxwebsite");
    //System.out.println("POOL !!!!");
    Connection con = ds.getConnection();
    con.setAutoCommit(false);
    return con;
    @WebMethod
    public String getIndexData(@WebParam(name="param") String param) {
    StringBuffer sb = new StringBuffer();
    String sql =
    "Select * From idx_index_info iii where iii.index_code= ?";
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
    con = getConn();
    pstmt = con.prepareStatement(sql);
    pstmt.setString(1, param);
    rs = pstmt.executeQuery();
    int columnCount = rs.getMetaData().getColumnCount();
    Object val;
    while (rs.next()) {
    for (int i = 1; i < columnCount; i++) {
    //System.out.println(i);
    val = rs.getObject(i);
    if (val != null)
    sb.append(val.toString() + "\n");
    } catch (SQLException e) {
    e.printStackTrace();
    } catch (NamingException e) {
    e.printStackTrace();
    } finally {
    try {
    if (rs != null)
    rs.close();
    if (pstmt != null)
    pstmt.close();
    if (con != null)
    con.close();
    } catch (Exception e) {
    e.printStackTrace();
    String str = sb.toString();
    int len = str.length();
    //System.out.println("LENGTH >>>>"+len);
    return str;
    public static void main(String[] arg) {
    Date date = new Date();
    System.out.println(date.toGMTString());
    getData gd = new getData();
    System.out.println(date.toGMTString());
    //System.out.println(gd.getIndexData("ACB"));
    * WebClient:
    package hnx;
    import java.util.Date;
    import java.util.Map;
    import javax.xml.namespace.QName;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPBody;
    import javax.xml.soap.SOAPBodyElement;
    import javax.xml.soap.SOAPElement;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.ws.BindingProvider;
    import javax.xml.ws.Dispatch;
    import javax.xml.ws.Service;
    import javax.xml.ws.WebServiceException;
    import javax.xml.ws.soap.SOAPBinding;
    public class wsClient {
    public wsClient() {
    super();
    public String procWeb() {
    String strmsg = null;
    try {
    QName serviceName = new QName("http://192.168.60.18:7001/","getDataService");
    // QName for Port As defined in wsdl.
    QName portName = new QName("http://192.168.60.18:7001/","getDataPort");
    // //Endpoint Address
    String endpointAddress = "http://192.168.60.18:7001/WsIndex/getDataPort?wsdl";
    // Create a dynamic Service instance
    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
    endpointAddress);
    // Create a dispatch instance
    Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
    SOAPMessage.class, Service.Mode.MESSAGE);
    // Use Dispatch as BindingProvider
    BindingProvider bp = (BindingProvider) dispatch;
    // Optionally Configure RequestContext to send SOAPAction HTTP Header
    Map<String, Object> rc = bp.getRequestContext();
    rc.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
    rc.put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://ws/");
    // Obtain a preconfigured SAAJ MessageFactory
    MessageFactory factory = ((SOAPBinding) bp.getBinding())
    .getMessageFactory();
    // Create SOAPMessage Request
    SOAPMessage request = factory.createMessage();
    // Request Body
    SOAPBody body = request.getSOAPBody();
    // Compose the soap:Body payload
    QName payloadName = new QName("http://ws/", "getIndexData","ns1");
    SOAPBodyElement payload = body.addBodyElement(payloadName);
    SOAPElement message = payload.addChildElement( "param");
    message.addTextNode("HNX302");
    request.saveChanges();
    // Invoke the endpoint synchronously
    System.out.println(message);
    SOAPMessage reply = null;
    try { // Invoke Endpoint Operation and read response
    reply = dispatch.invoke(request);
    } catch (WebServiceException wse) {
    wse.printStackTrace();
    // process the reply
    SOAPBody bodyRes = reply.getSOAPBody();
    SOAPBodyElement nextSoapBodyElement = (SOAPBodyElement) bodyRes
    .getChildElements().next();
    SOAPElement soapElement = (SOAPElement) nextSoapBodyElement
    .getChildElements().next();
    strmsg = soapElement.getValue();
    System.out.println("AAA >>"+strmsg);
    } catch (Exception wse) {
    wse.printStackTrace();
    return strmsg;
    public static void main(String[] arg) {
    wsClient ws = new wsClient();
    Date date = new Date();
    System.out.println(date.toGMTString());
    System.out.println(ws.procWeb());
    System.out.println(date.toGMTString());
    * Servlet:
    package hnx;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import ws.GetData;
    import ws.GetDataPortClient;
    import ws.GetDataService;
    public class getIndex extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    public void doPost(HttpServletRequest request,
    HttpServletResponse response) throws ServletException,
    IOException {
    doGet(request, response);
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException,
    IOException {
    response.reset();
    response.flushBuffer();
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    // GetDataService service = new GetDataService();
    // GetData getData = service.getGetDataPort();
    // String str = getData.getIndexData("HNX302");
    // int length = str.length();
    // response.setContentLength(length);
    wsClient ws = new wsClient();
    String str = ws.procWeb();
    try {
    out.println(str);
    } catch (Exception e) {
    e.printStackTrace();
    out.close();
    ERROR: >>>>>[Another instance of the application is running on the server.  JDeveloper redeploy the application.]
    [Application SClient stopped but not undeployed from Server Instance IntegratedWebLogicServer]
    [Running application SClient on Server Instance IntegratedWebLogicServer...]
    [03:41:48 PM] ---- Deployment started. ----
    [03:41:48 PM] Target platform is (Weblogic 10.3).
    [03:41:48 PM] Retrieving existing application information
    [03:41:48 PM] Running dependency analysis...
    [03:41:48 PM] Deploying 2 profiles...
    [03:41:48 PM] Wrote Web Application Module to C:\Users\W7\AppData\Roaming\JDeveloper\system11.1.1.2.36.55.36\o.j2ee\drs\SClient\sgetDataWebApp.war
    [03:41:48 PM] Wrote Enterprise Application Module to C:\Users\W7\AppData\Roaming\JDeveloper\system11.1.1.2.36.55.36\o.j2ee\drs\SClient
    [03:41:49 PM] Redeploying Application...
    [03:41:49 PM] Application Redeployed Successfully.
    [03:41:49 PM] The following URL context root(s) were defined and can be used as a starting point to test your application:
    [03:41:49 PM] http://192.168.9.100:7101/SClient
    [03:41:49 PM] Elapsed time for deployment: 1 second
    [03:41:49 PM] ---- Deployment finished. ----
    Run startup time: 1380 ms.
    [Application SClient deployed to Server Instance IntegratedWebLogicServer]
    Target URL -- http://127.0.0.1:7101/SClient/getindex
    [param: null]
    javax.xml.ws.WebServiceException: com.ctc.wstx.exc.WstxIOException: Exceeding stated content length of 228
         at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:117)
         at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
         at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:165)
         at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:101)
         at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:604)
         at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:563)
         at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:548)
         at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:445)
         at com.sun.xml.ws.client.Stub.process(Stub.java:248)
         at com.sun.xml.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:189)
         at com.sun.xml.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:215)
         at hnx.wsClient.procWeb(wsClient.java:75)
         at hnx.getIndex.doGet(getIndex.java:40)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: com.ctc.wstx.exc.WstxIOException: Exceeding stated content length of 228
         at com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1687)
         at com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
         at com.sun.xml.ws.message.saaj.SAAJMessage.writeTo(SAAJMessage.java:396)
         at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:114)
         ... 29 more
    Caused by: java.net.ProtocolException: Exceeding stated content length of 228
         at weblogic.net.http.ContentLengthOutputStream.write(ContentLengthOutputStream.java:39)
         at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:96)
         at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
         at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:194)
         at com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1685)
         ... 32 more
    java.lang.NullPointerException
         at hnx.wsClient.procWeb(wsClient.java:82)
         at hnx.getIndex.doGet(getIndex.java:40)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Can anyone help?
    Thanks in advance.
    LTThoi

    I'm no webservices/servlet expert , but can you check the obvious out here -
    javax.xml.ws.WebServiceException: com.ctc.wstx.exc.WstxIOException: Exceeding stated content length of 228
    at ......
    at hnx.wsClient.procWeb(wsClient.java:75)+ // check if you are passign something thats more than 228 chars
    at hnx.getIndex.doGet(getIndex.java:40)

  • How to call webservice?

    Hello,
    i am trying to call webservice.i tryed  following code for calling webservices via actionscript.it is givind the response.but it is not giving correct response.
    is this correct way to call webservice?is there other way to call webservice?can anybody tell me,how to call webservice?
    <mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”vertical” width=”420″ height=”380″ xmlns:net=”flash.net.*”>
    <mx:Script><![CDATA[
    import mx.rpc.soap.LoadEvent;
    import mx.rpc.AbstractOperation;
    import mx.controls.Alert;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.soap.Operation;
    import mx.rpc.soap.WebService;
    private var serviceURL:String = "http://localhost:7080/icon-ws/services";
    private var wsdlURL:String = "http://localhost:7080/icon-ws/bulkUpload.wsdl";
    private function callWS():void {
    var service:WebService = new WebService(serviceURL, serviceURL);
    service.wsdl = wsdlURL;
    service.loadWSDL();
    var oper:Operation = service.getOperation("BulkUpload") as Operation;
    oper.addEventListener("result", resultHandler);
    oper.addEventListener("fault", faultHandler);
    oper.send();
    public function resultHandler(event:ResultEvent):void {
    Alert.show("Result returned"+ event.result.toString());
    public function faultHandler(event:FaultEvent):void {
    Alert.show("fault: "+ event.toString());
    ]]></mx:Script>
    <mx:Button id=”selectBut” label=”CALL webservice” click=”callWS()”/>
    </mx:Application>

    sorry for my english. I expect you understand me...
    I do that extended sp 
    Code Block
    use atdb_main_test
    Declare @Object as Int;
    Declare @ResponseText as Varchar(8000);
    DECLARE @login VARCHAR(50);
    DECLARE @user_passwd VARCHAR(50)
    Exec master..sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
    Exec master..sp_OAMethod @Object, 'open', NULL, 'get', 'http://172.xx.xx.xx:wwww/account.asmx?op=CreateEquipementMacAddress', 'false'
    EXEC master..sp_OASetProperty @Object, 'user_login', @login
    EXEC master..sp_OASetProperty @Object, 'user_passwd', @user_passwd
    EXEC master..sp_OASetProperty @Object, 'p_nb_poste', 1
    EXEC master..sp_OASetProperty @Object, 'p_id_site', 91400
    EXEC master..sp_OASetProperty @Object, 'p_id_type_poste', 83
    EXEC master..sp_OASetProperty @Object, 'p_adresse_mac', null
    EXEC master..sp_OASetProperty @Object, 'p_num_serie', null
    EXEC master..sp_OASetProperty @Object, 'login', null
    EXEC master..sp_OASetProperty @Object, 'passwd', null
    EXEC master..sp_OASetProperty @Object, 'default_gateway', null
    EXEC master..sp_OASetProperty @Object, 'ip', null
    EXEC master..sp_OASetProperty @Object, 'bCreateIPPhone', 'false'
    EXEC master..sp_OASetProperty @Object, 'vlanId', 0
    Exec master..sp_OAMethod @Object, 'send'
    Exec master..sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
    Select @ResponseText as ResponseText
    Exec master..sp_OADestroy @Object
    I use a SQL server 2000 and don't do anything else.
    But it doesn't work
    I don't know what to do ...
    the message is (1 row affected) but no tupple is written in my db...
    can you help me please ?

Maybe you are looking for