이전에 SOAP을 통해 PHP (rpc) 메소드를 호출하는 Java 프로그램이 있습니다. 며칠 후 기존 코드에서 더 이상 작동하지 않습니다. 내 dev 컴퓨터에서 최근에 php7.0으로 업데이트되었지만 원격 서버에는 여전히 php5.x가 실행 중입니다. localhost 나 원격 서버에서는 작동하지 않습니다. 두 시스템 (원격 14.04 DEV 16.04)PHP : Java에서 SOAP rpc webservice를 호출하는 중 오류 발생 -
우분투를 실행하고 난 항상 다음과 같은 오류 얻을 :
[SOAPException: faultCode=SOAP-ENV:Client; msg=Parsing error, response was:
The processing instruction target matching "[xX][mM][lL]" is not allowed.; targetException=org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6;
The processing instruction target matching "[xX][mM][lL]" is not allowed.]
내가 SOAP의 UI 테스트를하고, 오류를 작동하지 않습니다. 나는 심지어 apache axis2로 테스트했지만 실패했다.
문제는 PHP 스크립트의 응답이 유효하지 않은 것 같습니다.
인코딩 등을보고 새로운 줄이 있는지 확인했습니다. 그러나 나는 그 문제가 무엇이 될 수 있는지 전혀 모른다. 비누 UI에서 작동
샘플 비누 전화 :
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:searchQuery xmlns:ns1="http://localhost/Server.php" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<query xsi:type="xsd:string">oil</query>
</ns1:searchQuery>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
응답 : 나는 비누 UI에서 유효성 검사를 클릭하면, 그것은 XML을 declration이 잘 형성되지 않는다는 것을 알려줍니다. 그러나 나는 그것을 어떻게 바꿀 지 모른다.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/Server.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><ns1:searchQueryResponse><return xsi:type="xsd:string">{
"prefixes": ..... }
</return></ns1:searchQueryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
나는 비누 서버 초기화하기 위해 사용하는 PHP 코드 :
try {
ini_set ("soap.wsdl_cache_enabled", "0");
$server = new SOAPServer ('Server.wsdl');
$server->setClass ('Webdienst');
$server->handle();
}
catch (SOAPFault $f) {
echo $f->getMessage();
}
내 WSDL 파일 :
<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://localhost/Server.php" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Webdienst" targetNamespace="http://localhost/Server.php">
<types>
<xsd:schema targetNamespace="http://localhost/Server.php">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
</xsd:schema>
</types>
<portType name="WebdienstPort">
<operation name="createRecord">
<documentation>Create a new record</documentation>
<input message="tns:createRecordIn"/>
<output message="tns:createRecordOut"/>
</operation>
<operation name="searchQuery">
<documentation>Search for the String</documentation>
<input message="tns:searchQueryIn"/>
<output message="tns:searchQueryOut"/>
</operation>
</portType>
<binding name="WebdienstBinding" type="tns:WebdienstPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="createRecord">
<soap:operation soapAction="http://localhost/Server.php#createRecord"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</output>
</operation>
<operation name="searchQuery">
<soap:operation soapAction="http://localhost/Server.php#searchQuery"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</output>
</operation>
</binding>
<service name="WebdienstService">
<port name="WebdienstPort" binding="tns:WebdienstBinding">
<soap:address location="http://localhost/Server.php"/>
</port>
</service>
<message name="createRecordIn">
<part name="recordURI" type="xsd:anyType"/>
<part name="documentURI" type="xsd:anyType"/>
<part name="content" type="xsd:anyType"/>
<part name="fileName" type="xsd:anyType"/>
<part name="mimeType" type="xsd:anyType"/>
<part name="creationDate" type="xsd:anyType"/>
<part name="datasetURI" type="xsd:anyType"/>
<part name="translatedContent" type="xsd:anyType"/>
<part name="alchemyTopics" type="xsd:anyType"/>
<part name="summary" type="xsd:anyType"/>
<part name="author" type="xsd:anyType"/>
</message>
<message name="createRecordOut">
<part name="return" type="xsd:string"/>
</message>
<message name="searchQueryIn">
<part name="query" type="xsd:anyType"/>
</message>
<message name="searchQueryOut">
<part name="return" type="xsd:string"/>
</message>
</definitions>