1

我想获得一个简单的 SOAP 调用以在 php 中工作,但我不知道出了什么问题。这是我第一次使用肥皂所以请温柔:)

当我像这样手动拨打电话时,一切正常

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header>
  <tem:AuthenticationHeader>
     <!--Optional:-->
     <tem:UserName>****</tem:UserName>
     <!--Optional:-->
     <tem:Password>***</tem:Password>
  </tem:AuthenticationHeader>
</soapenv:Header>
<soapenv:Body>
 <tem:SignUp>
     <!--Optional:-->
     <tem:email>test@test.se</tem:email>
     <!--Optional:-->
     <tem:password>password</tem:password>
  </tem:SignUp>
</soapenv:Body>
</soapenv:Envelope>

但是当我在 php 中执行此操作时,我得到“函数(“SignUp”)不是此服务的有效方法”

try {
    $soap_client = new SoapClient("http://url.com/Service.asmx?WSDL");
    $soapHeader = array('UserName' => '*****','Password' => '***');
    // Soap Header initialization
    $header = new SOAPHeader('http://tempuri.org/', 'AuthenticationHeader', $soapHeader);        
    // add the Header to the Soap Client before request
    $soap_client->__setSoapHeaders($header); 
    $args  = array('email'=>'tetsing@pp.se','password' =>'tetsing');
    $user = $soap_client->SignUp($args);
    print_r($user);

} catch (Exception $e) {
    print_r($e);
}

编辑1:添加了 WSDL

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
    <s:element name="AuthenticationHeader" type="tns:AuthenticationHeader"/>
    <s:complexType name="AuthenticationHeader">...</s:complexType>
    <s:element name="SignUp">
      <s:complexType>
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="email" type="s:string"/>
          <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
        </s:sequence>
      </s:complexType>
     </s:element>

编辑2:

编辑 3:getFunctions 提供 med

    array(18) {
  [0]=>
  string(80) "GetGameProgressDataResponse GetGameProgressData(GetGameProgressData $parameters)"
  [1]=>
  string(101) "GetGameParticipantPicturesResponse GetGameParticipantPictures(GetGameParticipantPictures $parameters)"
  [2]=>
  string(41) "SignUpResponse SignUp(SignUp $parameters)"
  [3]=>
  string(38) "LoginResponse Login(Login $parameters)"
  [4]=>
  string(53) "CreateGameResponse CreateGame(CreateGame $parameters)"
  [5]=>
  string(62) "GetActivitiesResponse GetActivities(GetActivities $parameters)"
  [6]=>
  string(62) "SetActivitiesResponse SetActivities(SetActivities $parameters)"
  [7]=>
  string(68) "GetParticipantsResponse GetParticipants(GetParticipants $parameters)"
  [8]=>
  string(68) "SetParticipantsResponse SetParticipants(SetParticipants $parameters)"
  [9]=>
  string(80) "GetGameProgressDataResponse GetGameProgressData(GetGameProgressData $parameters)"
  [10]=>
  string(101) "GetGameParticipantPicturesResponse GetGameParticipantPictures(GetGameParticipantPictures $parameters)"
  [11]=>
  string(41) "SignUpResponse SignUp(SignUp $parameters)"
  [12]=>
  string(38) "LoginResponse Login(Login $parameters)"
  [13]=>
  string(53) "CreateGameResponse CreateGame(CreateGame $parameters)"
  [14]=>
  string(62) "GetActivitiesResponse GetActivities(GetActivities $parameters)"
  [15]=>
  string(62) "SetActivitiesResponse SetActivities(SetActivities $parameters)"
  [16]=>
  string(68) "GetParticipantsResponse GetParticipants(GetParticipants $parameters)"
  [17]=>
  string(68) "SetParticipantsResponse SetParticipants(SetParticipants $parameters)"
}
4

1 回答 1

0

代码很好,这是服务器问题,他们修复了。

于 2013-01-26T12:37:01.323 回答