简体   繁体   English

请求Soap WSDL

[英]Request Soap WSDL

I've started a new project with soap request, i follow some tutorials about it and it doesn't work as well as it should. 我已经开始了一个新的肥皂请求项目,我遵循了一些有关它的教程,但是效果并不理想。

I use this part of code for the request : 我将这部分代码用于请求:

$client = new SoapClient("WSDL");
 
$param = array(
  "requestDate" => $date,
  "accountUID" => $id,
  "userID" => $id,
  "locale" => $local,
  "authenticationInfo" => array("password" => $pass),
  "image" => array(
                "type" => $type,
                "light" => $light,
                "source" => $source,
                                //the image has to be in base64binary
                "image" => base64_encode((fread(fopen("file", "r"), filesize("file"))))
            )
             
    );
 
try{
   //checkImage --> function on the server side
   $answer = $client->checkImage($param);
}
catch(SoapFault $e){
   echo $e;
}

And it give me this error : 它给了我这个错误:

SoapFault exception: [HTTP] Unsupported Media Type Stack trace: SoapFault异常:[HTTP]不支持的媒体类型堆栈跟踪:

> #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://smartey...', '', 1, 0)
> #1 SoapClient->__call('checkImage', Array)
> #2 SoapClient->checkImage(Array)

The type of all the parameters are okay according to the documentation i've got. 根据我得到的文档,所有参数的类型都可以。 And the php part seems okay to me and to all the tutorials i've found. php部分对我和我发现的所有教程似乎都还可以。

I'm wondering if it is a header problem or something like that. 我想知道这是标题问题还是类似的问题。

The WSDL is [here]( https://smarteye.ariadnext.com/ariadnext/ws/SmartEyeWs_v1r0?wsdl WSDL在[这里]( https://smarteye.ariadnext.com/ariadnext/ws/SmartEyeWs_v1r0?wsdl
)

If someone has an idea or a clue for this problem, i'm starting to drive crazy ! 如果有人对这个问题有想法或线索,我就会发疯了!

Thanks . 谢谢 。

The error message "unsupported media type" means that the peer HTTP server does not support the Content-type used to encode the request message. 错误消息“不支持的媒体类型”表示对等HTTP服务器不支持用于对请求消息进行编码的Content-type。 The message exchange is regarded as having completed unsuccessfully. 消息交换被视为未成功完成。

You should contact the web-service provider concerning the content-type/encoding they expect. 您应就其期望的内容类型/编码与网络服务提供商联系。

A possible solution if you are using SOAP_1_2is to change to SOAP_1_1 since that will alter the requests made. 如果您使用的是SOAP_1_2,则可能的解决方案是更改为SOAP_1_1,因为这会更改发出的请求。

This can be accomplished with: 这可以通过以下方式完成:

'soap_version' => SOAP_1_1;

This is a duplicate of this post: SoapFault exception: [HTTP] Unsupported Media Type when accessing Java web-service from PHP 这是此文章的重复: SoapFault异常:[HTTP]从PHP访问Java Web服务时不支持的媒体类型

server must support soap fault try this 服务器必须支持肥皂故障,请尝试此

try{
          //checkImage --> function on the server side
      $answer = $client->checkImage($param);
    }
    catch (Exception $e) {
            echo $e->getMessage();   
        }

good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM