2012-03-19 2 views
0

내 파트너의 내부 SOAP 인터페이스에 대한 설명서를 받았습니다. 그것은 말한다 :내부 SOAP 인터페이스의 함수를 사용하여 PHP를 통해

MyPARTNER web services are provided in the form of a SOAP interface. The service is available in this URL: https://justsomeurl.com:435/soap

다음 다음 인증 등과 접근 방법에 대한 부분에 대한 몇 가지 즐 즐 : 다음

pull()

The PULL method is used for pulling data from the database. The method receives a unique data based parameter under an internal name requestXML. This parameter contains data in a structured XML format.

String pull(String requestXML)

The XML contains data required to make the request, and the response data is sent back.

다른 방법은, 오류 코드, 그것은 여기 ... 을 중요하지 않아 문제는 내가 완전히 SOAP에 익숙하지 않기 때문에 PHP를 통해이 인터페이스를 사용하는 방법을 모른다. 몇 가지 예제와 튜토리얼을 찾으려고 노력했지만 SOAP과 그 기능에 대해 좀 더 많은 정보를 얻었지만 여전히 이와 같은 인터페이스를 사용하는 방법에 대한 조언을 찾지 못했습니다 ...

모든 도움을

답변

1

PHP는 PHP SOAP 라이브러리와 함께 제공됩니다. PHP 라이브러리는 일반적으로 일반적인 PHP 설치 후에 포함되고 활성화됩니다.

Yuo는 webservice 패턴의 클라이언트 부분을 유도해야합니다. 파트너가 웹 서비스의 .wsdl을 제공해야합니다. wsdl은 avialble 메소드, 필요한 매개 변수 및 리턴 값을 설명합니다.

Tipically 매개 변수와 반환 값이 당신의 코드에 대한 골격이 될 수

배열 구조입니다 : 여기

//build a client for the service 
$client = new SoapClient("partner.wsdl"); 

//$client is now a sort of object where you can call functions 
//prepare the xml parameter 
$requestXML = array("parameter" => "<xml>Hello</xml>"); 

//call the pull function this is like 
$result = $client->__soapCall("pull", $requestXML); 

//print the value returned by the web service 
print_r($result); 

은 비 WSDL 예를 먼저 위치 paramater는 SOAP 요청 주소입니다 다음과 에 전송됩니다. uri 매개 변수는 SOAP 서비스의 대상 네임 스페이스입니다. 이것은 xml 네임 스페이스와 관련이 있습니다.

샘플 코드는 다음과 같을 수 있습니다. // URI 사양의 경우 파트너 문서를 참조하십시오. 어쩌면 가짜 URL이 작동 할 수도 있습니다. // 서비스 클라이언트를 빌드하십시오. $ client = new SoapClient (null, array ( 'location'=> "https://justsomeurl.com:435/soap ", 'uri'=>"urn : WebServices ", 'trace'=> 1)); http://www.herongyang.com/PHP/SOAP-Use-SOAP-Extension-in-non-WSDL-Mode.html

+0

그래, 난이 도서관에 대해 읽었습니다,하지만 확실히 필요하다 '가 된 .wsdl'를 가지고 : 여기에 유용한 링크

// Once built a non-wsdl web service works as a wsdl one //$client is now a sort of object where you can call functions //prepare the xml parameter $requestXML = array("parameter" => "<xml>Hello</xml>"); //call the pull function this is like $result = $client->__soapCall("pull", $requestXML); //print the value returned by the web service print_r($result); 

? 내가 가진 모든 것은 위에서 언급 한 URL이기 때문에 ... '.wsdl'파일없이 SoapClient를 사용할 수있는 방법이 있습니까? – flipis

+0

예있다 : http://stackoverflow.com/questions/928169/php-soap-non-wsdl-call-how-do-you-pass-parameters –

+0

링크를위한 확인, 고맙습니다, 그것은 나에게 조금 명확합니다. .watever (나에게 절름발이라고 불러도된다). SoapClient 생성자의 options 배열의 매개 변수 'location'과 'uri'에 무엇을 설정해야하는지 아직 명확하지 않다. 내 URL을 사용하여 구체적인 예를 보여 주시겠습니까? 나는 매우 감사 할 것입니다 – flipis

관련 문제