MyMemory の翻訳 Web サービスを使用しようとしています: http://mymemory.translated.net/doc/spec.php
残念ながら、Zend_Soap_Client はサービスによって認識されない XML 要求オブジェクトを生成します。タグ内の ns1-Attribute (名前空間) が原因だと思います。それで、誰もそれらを削除する方法を知っていますか?
それは基本的に私がすることです:
$client = new Zend_Soap_Client('http://mymemory.translated.net/otms/?wsdl', array(
'soap_version' => SOAP_1_1
));
次に、関数を呼び出します。
try {
$client->otmsGet(array(
'key' => 'xxx',
'q' => array(
'source' => 'Computer Science',
'source_lang' => 'en-US',
'target_lang' => 'de-DE'
)
));
} catch(Exception $e) {
print $client->getLastRequest();
}
結果の XML は次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
<ns1:otmsGet>
<ns1:key>xxx</ns1:key>
<ns1:q>
<ns1:source>Computer Science</ns1:source>
<ns1:source_lang>en-US</ns1:source_lang>
<ns1:target_lang>de-DE</ns1:target_lang>
</ns1:q>
</ns1:otmsGet>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
実際には次のようになります。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<otmsGet xmlns="http://tempuri.org/">
<key xmlns:SOAPSDK1="http://tempuri.org/">mmDemo123</key>
<q xmlns:SOAPSDK2="http://tempuri.org/">
<source>control panel</source>
<source_lang>en-US</source_lang>
<target_lang>es-ES</target_lang>
</q>
</otmsGet>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
ご協力いただきありがとうございます!