2017-12-26 98 views
-1

SOAP 기반 웹 서비스를 실행하기 위해 가라테 API을 배우고 있습니다. 이를 위해 필자는 두 가지 XML 파일을 만들었습니다. 하나는 요청 정보이고 다른 하나는 응답 데이터입니다.공수를 사용하여 주어진 XML로 SOAP 서비스 XML 파일의 유효성을 검사하는 방법

그리고 나서 하나 더 파일을 만들었습니다 webservice.feature 파일이라고합니다.

이 기능 파일을 실행할 때 콘솔에서 다음 정보가 표시되지만 이해가되지 않으며 그 유효성을 검사하는 방법을 알지 못합니다. 제안을 해주십시오.

webservice.feature 파일 :

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 

요청 파일.

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

응답 파일 :

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

콘솔 출력 :

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'\\)$")... 

덕분에

+0

다음과 같은 스 니펫으로 누락 된 단계를 구현할 수 있습니다. @Given ("^ url 'http : // (\\ d +) \\. (\\ d +) \\. (\\ d +) \\.public void url_http_Customer_ProxyServices_CustomerSummary_PS_wsdl (int arg1, int arg2, int arg3, int arg4, int arg5) throws Throwable { // 쓰기 (예 : \ d +)/고객/프록시 서비스/고객/프록시 서비스/고객 서머리 _PS \\? wsdl '$ " 위의 구문을 구체적인 동작으로 바꾸는 코드는 new PendingException(); .......... – Karunagara

+0

프로젝트 구조 자체가 잘못되어 보이는 것처럼 보이며 아무도 웹 서비스의 내용을 제공하지 않으면 도움을 줄 수 없습니다. . 특징. 당신은 여기에서 더 열심히 노력할 필요가 있습니다 : https://stackoverflow.com/help/mcve –

+0

그래서 그것을 고쳐야합니까? – Karunagara

답변

0

오류 메시지는 표준 오이의 잘못을 것 같다 또는 공수 아닙니다. 프로젝트 구조 자체가 잘못되어있는 것처럼 보입니다. 설명서에 따라 지침을 따르는 것이 좋습니다 : Quickstart. 다음 명령을 실행 soap.feature :이 기능은 파일을 생성

다음

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

다음 users.feature에. 언급 된대로 url'http://www.dneonline.com/calculator.asmx'으로 변경할 수 있습니다. 이제 마우스 오른쪽 버튼을 클릭하고 UsersRunner.java을 JUnit 테스트로 실행하면 작동하는 것을 볼 수 있습니다.

+0

웹 사이트에서 제공하는 지침을 따르고 soap.feature를 실행하고 응답을받을 수 있습니다. 내 프로젝트 폴더 구조는 src/test/java/feature입니다. /*.특색. 잘못된 구조인가요? 문제는 실시간 서비스를 실행할 수 없다는 것입니다. – Karunagara

+0

예, 잘못된 구조 –

+0

제안 된 링크를 기반으로 추적했기 때문에 정확한 구조가되어야하는 방법을 알려주십시오 ... 샘플은 실행 중이지만 우리를 실행할 수는 없습니다 ... 정말 모르겠습니다 ... – Karunagara