Help! How to use web service request to create test script in Vugen

How will I use this to create a test? 

<soapenv:Envelope xmlns:cpw="http://www.testing.com/corporate/enchant/ws/genericmodule" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header>
<wsu:Timestamp wsu:Id="ZjhlMjdmNDI3ODRmNDlhY2FjZDQ2Y2JjN2Q4NGFjNWY=" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2018-07-13T04:50:19Z</wsu:Created>
<wsu:Expires>2018-07-20T04:50:19Z</wsu:Expires>
</wsu:Timestamp>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="unt_NWMwMDQxNzFjN2Yx" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>USERNAME__DATABASEID</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">********</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">YTZjOWM2NTJjM2IyNGU1ZWFlMzVhMWNlZjc3YWI4YjA=</wsse:Nonce>
<wsu:Created>2018-07-13T04:50:19Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>

<soapenv:Body>
<apw:apwwsgenericimport>
<apw:systemName>DATABASEID</apw:systemName>
<apw:companyId>1</apw:companyId>
<apw:document>


&lt;barnimport xmlns=&apos;http://www.testing.com/corporate/enchant/barnimport&apos; xmlns:xsi=&apos;http://www.w3.org/2001/XMLSchema-instance&apos;&gt;
&lt;APMCUST_CUST_HDR tranType=&apos;INSERT&apos;&gt;
&lt;ACKN_REQD_FL&gt;N&lt;/ACKN_REQD_FL&gt;
&lt;ALLOW_SUBST_FL&gt;N&lt;/ALLOW_SUBST_FL&gt;
&lt;APPLY_FIN_CHG_FL&gt;N&lt;/APPLY_FIN_CHG_FL&gt;
&lt;CUST_ID&gt;AMCUST&lt;/CUST_ID&gt;
&lt;CUST_LONG_NAME&gt;test&lt;/CUST_LONG_NAME&gt;
&lt;CUST_NAME&gt;test&lt;/CUST_NAME&gt;
&lt;CUST_TYPE_DC&gt;ACTYPE001&lt;/CUST_TYPE_DC&gt;
&lt;DISC_ALLOW_FL&gt;N&lt;/DISC_ALLOW_FL&gt;
&lt;OVRSHP_ALLOW_FL&gt;N&lt;/OVRSHP_ALLOW_FL&gt;
&lt;PARTIAL_SHIP_FL&gt;N&lt;/PARTIAL_SHIP_FL&gt;
&lt;S_CREDIT_STATUS_CD&gt;O&lt;/S_CREDIT_STATUS_CD&gt;
&lt;USE_WAW_FL&gt;N&lt;/USE_WAW_FL&gt;

&lt;APMCUST_CUSTADDR_CTW tranType=&apos;INSERT&apos;&gt;
&lt;ADDR_DC&gt;123456&lt;/ADDR_DC&gt;
&lt;S_BILL_ADDR_CD&gt;N&lt;/S_BILL_ADDR_CD&gt;
&lt;S_MARK_FOR_ADDR_CD&gt;N&lt;/S_MARK_FOR_ADDR_CD&gt;
&lt;S_SHIP_ADDR_CD&gt;N&lt;/S_SHIP_ADDR_CD&gt;
&lt;APMCUST_CUSTADDRCNTACT_CTW tranType=&apos;INSERT&apos;&gt;
&lt;CNTACT_ID&gt;testcntact&lt;/CNTACT_ID&gt;
&lt;/APMCUST_CUSTADDRCNTACT_CTW&gt;
&lt;/APMCUST_CUSTADDR_CTW&gt;

&lt;/APMCUST_CUST_HDR&gt;

&lt;/barnimport&gt;

</apw:document>
</apw:genericimport>
</soapenv:Body>
</soapenv:Envelope>

  • Hi, 

    you can use Web HTTP-HTML protocol to create a function to recall your request, using web_custom_request function: 

      web_custom_request("requestName",
         "URL=http://...,
         "Method=POST",
         "Body="     
       ...,
      LAST);

    You have to specified the URL, the method request (GET or POST) and copied the body (sorrounding every row of the soap request with double quotes). The argument in "Body" can be parametrized, so copied in a file ".dat" and loaded into the script with the name of your parameter, in this case your function can be

    web_custom_request("requestName",
         "URL=http://...,
         "Method=POST",
         "Body=" {bodyParam},    
      LAST);

    In alternative, you can use the Web Service protocol: with this method you have to specified the URL and load the request file, after that the protocol itself will create the web_service_call function. So, use the option "Manage Services" and click on "Import Service" to point the correct URL and load your whole request. 

    Hope to been helpful, 

    Lorenzo

     

     

  • Thanks! I had some progress; however, I got a status code 500 and here's the error:

     

    <faultcode>wsse:InvalidSecurityToken</faultcode><faultstring>Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenValidateResult@29c5c0f8[statusfalse][msg UNT Error:Message older than allowed MessageAge]</faultstring>

     

    Not sure if correlation is applicable but I noticed a:

     

    "<wsu:Timestamp wsu:Id=\"NDI1MDI2ODM1ZDc0NDA5MTlhOTlhMzRjMThkZWU5ZGU=\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">"

     

    Is there a way to handle this?

    TIA!

  • Verified Answer

    I have finally solved the problem.

    1.  remove the <soapenv:Header>

    2. create a web_service_set_security then provide the user, password.