SysAidという製品の SOAP クライアントを作成するために、soap4r ( https://github.com/mumboe/soap4rから) を使用しようとしています。
Java での SOAP クライアントの実例があり、ほとんどのメソッドで Ruby クライアントも動作します。Java クライアントは、Ruby バージョンのエラーを判別するのに役立ちます。
特定の呼び出しを使用すると、エラーが発生します。
SOAP::FaultError: prefix xs is not bound to a namespace
そのエラーを生成した、soap4r が送信したメッセージは次のとおりです。
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<n1:save xmlns:n1="http://api.ilient.com/">
<sessionId>1339292997261</sessionId>
<apiSysObj xsi:type="n1:apiServiceRequest">
<customDateFields></customDateFields>
<customFields>
<entry>
<key xsi:type="xs:string">sr_cust_dafis_fau</key>
<value xsi:type="xs:string"></value>
</entry>
<entry>
<key xsi:type="xs:string">sr_cust_activity</key>
</entry>
</customFields>
<description>This is the description of the ticket.</description>
</apiSysObj>
</n1:save>
</env:Body>
</env:Envelope>
そして、これはJavaが同じメソッドに対して送信するものであり、サーバーは文句を言いません:
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:save xmlns:ns2="http://api.ilient.com/">
<sessionId>1339199684324</sessionId>
<apiSysObj xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:apiServiceRequest">
<customDateFields/><customFields>
<entry>
<key xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">sr_cust_dafis_fau</key>
<value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value>
</entry>
<entry>
<key xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">sr_cust_activity</key>
</entry>
</customFields>
<description>This is the description of the ticket.</description>
</apiSysObj>
</ns2:save>
</S:Body>
</S:Envelope>
ご覧のとおり、エラーは customFields タグから発生しています。soap4r は key タグの xmlns:xs 属性を省略していますが、Java はそれを入れています。
私が知る限り、soap4r は他のメソッド呼び出しでこのような重大なエラーを起こしません。
この必要な属性をキータグに追加するには、soap4r を取得するにはどうすればよいですか?