Home  >  Article  >  Backend Development  >  请教一个soap的问题。在线等。谢谢

请教一个soap的问题。在线等。谢谢

WBOY
WBOYOriginal
2016-06-23 14:27:03948browse

  <?xml version="1.0" encoding="UTF-8" ?> - <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-b01-.   --> - <!--  Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-b01-.   --> - <definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://XXXXX/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://XXXXX/" name="Service4business">- <types>- <xsd:schema>  <xsd:import namespace="http://XXXXX/" schemaLocation="http://XXXXX:18080/aaa/Business/XXXXXService?xsd=1" />   </xsd:schema>  </types>- <message name="queryUserInfo">  <part name="parameters" element="tns:queryUserInfo" />   </message>- <message name="queryUserInfoResponse">  <part name="parameters" element="tns:queryUserInfoResponse" />   </message>- <message name="queryGroupInfo">  <part name="parameters" element="tns:queryGroupInfo" />   </message>- <message name="queryGroupInfoResponse">  <part name="parameters" element="tns:queryGroupInfoResponse" />   </message>- <message name="authProduct">  <part name="parameters" element="tns:authProduct" />   </message>- <message name="authProductResponse">  <part name="parameters" element="tns:authProductResponse" />   </message>- <message name="authUser">  <part name="parameters" element="tns:authUser" />   </message>- <message name="authUserResponse">  <part name="parameters" element="tns:authUserResponse" />   </message>- <message name="registerIMS">  <part name="parameters" element="tns:registerIMS" />   </message>- <message name="registerIMSResponse">  <part name="parameters" element="tns:registerIMSResponse" />   </message>- <message name="authIMS">  <part name="parameters" element="tns:authIMS" />   </message>- <message name="authIMSResponse">  <part name="parameters" element="tns:authIMSResponse" />   </message>- <portType name="CoshipService4Business">- <operation name="queryUserInfo">  <input message="tns:queryUserInfo" />   <output message="tns:queryUserInfoResponse" />   </operation>- <operation name="queryGroupInfo">  <input message="tns:queryGroupInfo" />   <output message="tns:queryGroupInfoResponse" />   </operation>- <operation name="authProduct">  <input message="tns:authProduct" />   <output message="tns:authProductResponse" />   </operation>- <operation name="authUser">  <input message="tns:authUser" />   <output message="tns:authUserResponse" />   </operation>- <operation name="registerIMS">  <input message="tns:registerIMS" />   <output message="tns:registerIMSResponse" />   </operation>- <operation name="authIMS">  <input message="tns:authIMS" />   <output message="tns:authIMSResponse" />   </operation>  </portType>- <binding name="CoshipService4BusinessPortBinding" type="tns:CoshipService4Business">  <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <operation name="queryUserInfo">  <soap12:operation soapAction="" /> - <input>  <soap12:body use="literal" />   </input>- <output>  <soap12:body use="literal" />   </output>  </operation>- <operation name="queryGroupInfo">  <soap12:operation soapAction="" /> - <input>  <soap12:body use="literal" />   </input>- <output>  <soap12:body use="literal" />   </output>  </operation>- <operation name="authProduct">  <soap12:operation soapAction="" /> - <input>  <soap12:body use="literal" />   </input>- <output>  <soap12:body use="literal" />   </output>  </operation>- <operation name="authUser">  <soap12:operation soapAction="" /> - <input>  <soap12:body use="literal" />   </input>- <output>  <soap12:body use="literal" />   </output>  </operation>- <operation name="registerIMS">  <soap12:operation soapAction="" /> - <input>  <soap12:body use="literal" />   </input>- <output>  <soap12:body use="literal" />   </output>  </operation>- <operation name="authIMS">  <soap12:operation soapAction="" /> - <input>  <soap12:body use="literal" />   </input>- <output>  <soap12:body use="literal" />   </output>  </operation>  </binding>- <service name="Service4business">- <port name="CoshipService4BusinessPort" binding="tns:CoshipService4BusinessPortBinding">  <soap12:address location="http://XXXXX" />   </port>  </service>  </definitions>







用的是 nusoap
我只要 'authProduct'  去调用一下就可以
$sendurl='http://10.10.10.10:18080/aaa/Business/Service?wsdl';		$client = new soapclient($sendurl, true);		//查看一下是不是报错  		$err = $client->getError();  		if ($err) {  		 //显示错误  编码		 echo '<h2>Constructor error</h2><pre class="brush:php;toolbar:false">' . $err . '
';   }   $client->soap_defencoding = 'utf-8'; $client->decode_utf8 = false; $client->xml_encoding = 'utf-8'; $param = array('AMSP_Auth_Prod'=>array('userCode'=>'1212','tvCode'=>'2848','productCode'=>'80060','spCode'=>'SP1N','resourceCode'=>'','authType'=>0)); dump($param); $result = $client->call('authProduct', $param); dump($client->request); if (!$err=$client->getError()) {   echo " ddd :",htmlentities($str,ENT_QUOTES);   } else {    echo " er :",htmlentities($err,ENT_QUOTES);   }  


生成的xml
080060SP1N28481212

在soapui里面可以的。但是程序报错

er :HTTP Error: Unsupported HTTP response status 415 Unsupported Media Type (soapclient->response has contents of the response)





回复讨论(解决方案)

在线等。自己up一下

头文件

string(860) "POST /aaa/Business/Service HTTP/1.0
Host: 172.31.178.4:18080
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 679

自己搞定了。我靠。痛苦死我了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn