-1

I'm learning Karate API for executing our SOAP-based web services. For that, I have created two XML files in which, one is, request information and another one is response data.

And then I have created one more file is called webservice.feature file.

When I execute this feature file I'm getting the following information in the Console but I don't understand and also I don't know how to validate that. Please give your suggestions.

webservice.feature File:

Feature: Get Membership Details

Background:
* url 'http://111.111.221.145:2201/Customer/ProxyServices/CustomerSummary_PS?wsdl'

Scenario: FunctionalTest
   Given request read('getMbrWksMembershipSummaryRequest.xml')

   And header Content-Type = 'application/soap+xml; charset=utf-8'
   When method post
   Then status 200
   And match response customerSummary/address/city == read('getMbrWksMembershipSummaryResponse.xml')
   And print 'response: ', response

Request File.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://www.abcdedf.com/services/customersummary" xmlns:con="http://www.abcdedf.com/services/customersummary/contract">
   <soapenv:Header/>
   <soapenv:Body>
      <cus:getMbrWksMembershipDetails>
         <!--Optional:-->
         <cus:WksMembershipSummaryRequest>
            <!--Optional:-->
            <channel>CC</channel>
            <!--Optional:-->
            <consumerName>GUIDE_PORTAL</consumerName>
            <level>0</level>
            <!--Optional:-->
            <locale>en_US</locale>
            <!--Optional:-->
            <productType>ExtraVacation</productType>
            <!--Optional:-->
            <requestId/>
            <!--Optional:-->
            <sessionId/>
            <!--Optional:-->
            <con:memberID>C05506493</con:memberID>
         </cus:WksMembershipSummaryRequest>
      </cus:getMbrWksMembershipDetails>
   </soapenv:Body>
</soapenv:Envelope>

Response File:

<ns2:customerSummary>
  <ns2:address>
    <ns2:city>SOUTH CHESTERFIELD</ns2:city>
    <ns2:country>USA</ns2:country>
    <ns2:isoCountryCode>US</ns2:isoCountryCode>
    <ns2:line1>9998, N. MICHIGAN ROAD.</ns2:line1>
    <ns2:postalCode>23834</ns2:postalCode>
    <ns2:state>VA</ns2:state>
  </ns2:address>
</ns2:customerSummary>

Console Output:

You can implement missing steps with the snippets below:

@Given("^url 'http://(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+):(\\d+)/Customer/ProxyServices/CustomerSummary_PS\\?wsdl'$")
public void url_http_Customer_ProxyServices_CustomerSummary_PS_wsdl(int arg1, int arg2, int arg3, int arg4, int arg5) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Given("^request read\\('getMbrWksMembershipSummaryRequest\\.xml'\\)$")...

Thanks

Karunagara
  • 389
  • 1
  • 8
  • 30
  • You can implement missing steps with the snippets below: @Given("^url 'http://(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+):(\\d+)/Customer/ProxyServices/CustomerSummary_PS\\?wsdl'$") public void url_http_Customer_ProxyServices_CustomerSummary_PS_wsdl(int arg1, int arg2, int arg3, int arg4, int arg5) throws Throwable { // Write code here that turns the phrase above into concrete actions throw new PendingException();.......... – Karunagara Dec 26 '17 at 07:37
  • looks like your project structure itself is wrong and no one can help you unless you provide the contents of `webservice.feature`. you need to try harder here, refer this: https://stackoverflow.com/help/mcve – Peter Thomas Dec 26 '17 at 08:50
  • so what shall i do to correct it? – Karunagara Dec 26 '17 at 09:24
  • follow the instructions in my previous comment and edit your question. all the best. – Peter Thomas Dec 26 '17 at 09:25
  • you need to be better at using stack overflow. I said edit the question. – Peter Thomas Dec 26 '17 at 09:27
  • Modified the information as per the comment... – Karunagara Dec 26 '17 at 09:37

1 Answers1

0

The error message seems to be a standard Cucumber error not Karate. It looks like your project structure itself is wrong. I suggest you follow the instructions as per the documentation: Quickstart. Run the following command:

mvn archetype:generate \ -DarchetypeGroupId=com.intuit.karate \ -DarchetypeArtifactId=karate-archetype \ -DarchetypeVersion=0.6.2 \ -DgroupId=com.mycompany \ -DartifactId=myproject

Then next to users.feature create this feature file: soap.feature. You can change the url to 'http://www.dneonline.com/calculator.asmx' as mentioned. Now if you right-click and run UsersRunner.java as a JUnit test, you should see things working.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • I followed the instructions given in the web site and I'm able to execute soap.feature and get the response.. My project folder structure is, src/test/java/feature/*.feature. Is that wrong structure? Problem is, i could not able to execute our real-time services. – Karunagara Dec 26 '17 at 11:05
  • Please tell me how it should be i.e correct structure because I followed based on the link that you suggested...samples are running but not able to execute ours... I really don't know... – Karunagara Dec 26 '17 at 11:37
  • 1
    i also don’t know, sorry. maybe some one else can help you. it is unfortunate that given so much documentation and examples you are not able to proceed. take time, read and understand. all the best. really. – Peter Thomas Dec 26 '17 at 11:38