개인 프로젝트를 위해 웹 사이트의 서비스를 사용하고 있습니다. 그래서 내가 오늘까지 알고 무엇을XML 파일로 PHP 요청을 생성합니다.
<Request Originator="xxxxx" Company="xxx">
<Range Code="xx">
<Item Id="xxxxxx-xxxxx-xxxxxx-xxx-7E8B94462F2C" />
</Range>
<KeyValues>
<Translations>
<Language Value="de" />
<Language Value="en" />
</Translations>
<Regions Show="true" />
<Towns Show="true" />
</KeyValues>
</Request>
편집 :
나는이 같은 XML 파일이 난이 URL에 대한 요청을 보내 하나입니다 http://interface.deskline.net/DSI/KeyValue.asmx?WSDL 해당 서버로는 통신하지만 항상 다음과 같은 오류 메시지가 표시됩니다.
soap:ReceiverSystem.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read() at System.Xml.XmlReader.MoveToContent() at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement() at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) --- End of inner exception stack trace ---1
나는 의사 소통을 얻지 못한다.
$url = 'http://interfacetest.deskline.net/DSI/KeyValue.asmx';
$content = 0;
if (file_exists('/mm/request.xml')) {
$xml = fopen('/mm/request.xml', "r");
$content = fread($xml,filesize("/mm/request.xml"));
fclose($xml);
} else {
echo 'No file, no request';
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// Following line is compulsary to add as it is:
curl_setopt($ch, CURLOPT_POSTFIELDS,
"xmlRequest=" . $content);
$response = curl_exec($ch);
echo $response;