Topic
14 replies Latest Post - ‏2012-06-28T13:04:42Z by brock_smith
SystemAdmin
SystemAdmin
570 Posts
ACCEPTED ANSWER

Pinned topic How to call iseries webserice in Worklight4.2.1

‏2012-05-25T11:29:28Z |
Dear All,
i have to call iseries base webservice that contains some function in it.
but how do i have to call in WorklightServer 4.2.1 using HTTP Adapter using method SOAP in my application.
Thanks,
Brock.
  • SystemAdmin
    SystemAdmin
    570 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-05-28T07:22:16Z  in response to SystemAdmin
    Hi,

    Look at Module 5.3 - Using HTTP Adapters with SOAP Services
    http://worklight.com/download/get-started/4.2.1/module-5.3
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-22T13:56:04Z  in response to SystemAdmin
    Hi All,

    i have attached the wsdl that i have to call in Worklight 4.2 plz provide the solution.
    • MikeZilbergleyt
      MikeZilbergleyt
      10 Posts
      ACCEPTED ANSWER

      Re: How to call iseries webserice in Worklight4.2.1

      ‏2012-06-22T14:27:49Z  in response to brock_smith
      You should use SOAP UI to build and test the request.

      I don't know if you have any WS-Security requirements, which is a different story,
      Assuming it is not required, then all you need is to copy the SOAP envelop to

      var req = "<... soap env >". Substitute variables from your request JSON and call the HTTP adapter.

      Mike Z
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-22T17:55:04Z  in response to SystemAdmin
    Hi Mike,

    Thanx for quick response.
    i have two scenerio
    i) i have access the www.webservicex.net/CurrencyConvertor.asmx this working fine with worklight
    ii) when i am accessing the attached wsdl it create a error for reference i have attached the image.
    here is the .js code
    function EPSCSMRTOperation() {
    var request =
    '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://zserveros.demos.ibm.com:18083/">'
    +'<soapenv:Header/>'
    +'<soapenv:Body>'
    +'<web:EPSCSMRTService>'
    +'<web:epspcom_principle_data>1000</web:epspcom_principle_data>'
    +'<web:epspcom_number_of_years>1</web:epspcom_number_of_years>'
    +'<web:epspcom_number_of_months>12</web:epspcom_number_of_months>'
    +'<web:epspcom_quoted_interest_rate>1.5</web:epspcom_quoted_interest_rate>'
    +'</web:EPSCSMRTService>'
    +'</soapenv:Body>'
    +'</soapenv:Envelope>';
    var input = {
    method : 'post',
    returnedContentType : 'xml',
    path : 'EPSCSMRT',
    body : {
    content : request.toString(),
    contentType: 'text/xml; charset=utf-8'
    }
    };
    var response = WL.Server.invokeHttp(input);
    return response;
    }


    .xml code
    <?xml version="1.0" encoding="UTF-8"?>
    <wl:adapter name="webSRVAdap"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wl="http://www.worklight.com/integration"
    xmlns:http="http://www.worklight.com/integration/http">

    <displayName>webSRVAdap</displayName>
    <description>webSRVAdap</description>
    <connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
    <protocol>http</protocol>
    <domain>zserveros.demos.ibm.com:18083</domain>
    <port>80</port>
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>

    <procedure name="EPSCSMRTOperation"/>
    </wl:adapter>
    Regards,

    ---Brock
    • MikeZilbergleyt
      MikeZilbergleyt
      10 Posts
      ACCEPTED ANSWER

      Re: How to call iseries webserice in Worklight4.2.1

      ‏2012-06-22T18:07:49Z  in response to brock_smith
      You problem is in the host definition:

      <domain>zserveros.demos.ibm.com:18083</domain>
      <port>80</port>

      If your port is 18083, it should look like this:

      <domain>zserveros.demos.ibm.com</domain>
      <port>18083</port>
      Mike Z
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-25T11:03:18Z  in response to SystemAdmin
    hi Mike,

    after updating the code now i am facing the below error

    {
    "Envelope": {
    "Body": {"Fault": {
    "": "",
    "faultcode": "SOAP-ENV:Client",
    "faultstring": "IGZ0282S XML to language structure conversion could not complete in program EPSCSMRI because none of the elements in the input XML document matched a mapped element in the XML Schema upon which the XML converter is based."
    }},
    "SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/",
    "soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
    "web": "http://zserveros.demos.ibm.com"
    },
    "errors": [],
    "info": [],
    "isSuccessful": true,
    "statusCode": 500,
    "statusReason": "Internal Server Error",
    "warnings": []
    }

    Regrds,
    Brock--
    • MikeZilbergleyt
      MikeZilbergleyt
      10 Posts
      ACCEPTED ANSWER

      Re: How to call iseries webserice in Worklight4.2.1

      ‏2012-06-25T13:52:30Z  in response to brock_smith
      I maybe mistaken, but I've never seen the namespace with a port number.
      Take a look at your soap env:

      xmlns:web="http://zserveros.demos.ibm.com:18083/">'
      Mike Z
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-25T14:14:45Z  in response to SystemAdmin
    Hi Mike,

    Thanx for reply

    i have replace my code to your suggested "<domain>zserveros.demos.ibm.com</domain> <port>18083</port>"
    then this error occured!

    {
    "Envelope": {
    "Body": {"Fault": {
    "": "",
    "faultcode": "SOAP-ENV:Client",
    "faultstring": "IGZ0282S XML to language structure conversion could not complete in program EPSCSMRI because none of the elements in the input XML document matched a mapped element in the XML Schema upon which the XML converter is based."
    }},
    "SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/",
    "soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
    "web": "http://zserveros.demos.ibm.com/"
    },
    "errors": [],
    "info": [],
    "isSuccessful": true,
    "statusCode": 500,
    "statusReason": "Internal Server Error",
    "warnings": []
    }
    Regards,
    Brock--
    • MikeZilbergleyt
      MikeZilbergleyt
      10 Posts
      ACCEPTED ANSWER

      Re: How to call iseries webserice in Worklight4.2.1

      ‏2012-06-25T14:20:55Z  in response to brock_smith
      Try calling this service with SOAP UI using the same envelop.
      • MikeZilbergleyt
        MikeZilbergleyt
        10 Posts
        ACCEPTED ANSWER

        Re: How to call iseries webserice in Worklight4.2.1

        ‏2012-06-25T14:24:34Z  in response to MikeZilbergleyt
        Here is what I got in SOAP UI after importing your WSDL:

        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:eps="http://www.EPSCSMRTI.com/schemas/EPSCSMRTIInterface">
        <soapenv:Header/>
        <soapenv:Body>
        <eps:DFHCOMMAREA>
        <eps:epspcom_principle_data>?</eps:epspcom_principle_data>
        <eps:epspcom_number_of_years>?</eps:epspcom_number_of_years>
        <eps:epspcom_number_of_months>?</eps:epspcom_number_of_months>
        <eps:epspcom_quoted_interest_rate>?</eps:epspcom_quoted_interest_rate>
        <eps:epspcom_year_month_ind>?</eps:epspcom_year_month_ind>
        </eps:DFHCOMMAREA>
        </soapenv:Body>
        </soapenv:Envelope>

        As you can see it is quite different from what you are sending.
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-25T15:02:17Z  in response to SystemAdmin
    Hi Mike,

    can u please consume my wsdl in Worklight project and attach to this thread!!! is it possible?

    Regards,
    Brock--
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-25T17:46:29Z  in response to SystemAdmin
    Hi Mike,
    Thank you so much!

    Regards,
    Brock--
  • brock_smith
    brock_smith
    12 Posts
    ACCEPTED ANSWER

    Re: How to call iseries webserice in Worklight4.2.1

    ‏2012-06-28T13:04:42Z  in response to SystemAdmin
    Hi Mike,
    Would u pl help me that how adapter will be use in Worklight Application!
    Regards,

    Brock--