0

Staeubli ロボット コントローラー (CS8) のインターフェイスをプログラミングしています。IO 情報を要求しようとするまで、すべてがスムーズに実行されます。リクエストは SOAP_EOF で終了します。私は他のいくつかのリクエストを試しましたが、それらはすべて正常に機能します。だから私は送信/受信パッケージをキャプチャしました.良いリクエストと悪いリクエストの唯一の違いは、応答のMIMEタイプです. 悪いもののリクエスト/レスポンスは次のとおりです。

リクエスト

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
    xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ns3="http://www.w3.org/2004/08/xop/include"
    xmlns:ns4="http://www.w3.org/2004/11/xmlmime"
    xmlns:ns5="http://tempuri.org/xmlmime.xsd"
    xmlns:ns1="CS8ServerV0"
    xmlns:ns2="urn:CS8ServerV1"
    xmlns:ns6="urn:CS8ServerV2" 
    xmlns:ns7="urn:CS8ServerV3">
    <SOAP-ENV:Header>
        <ns1:sessionId SOAP-ENV:mustUnderstand="true">18638456</ns1:sessionId>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns6:getAllPhysicalIos></ns6:getAllPhysicalIos>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

応答

--==pj+EhsWuSQJxx7przmb8HM+ZkeNcG3HezSNID7LmfDa9J4lfdUL8W1F7TNJK==
Content-Type: application/xop+xml; charset=utf-8; type="application/soap+xml; charset=utf-8"
Content-Transfer-Encoding: binary
Content-ID: <SOAP-ENV:Envelope>

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
    xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:SCSV0="CS8ServerV0"
    xmlns:xop="http://www.w3.org/2004/08/xop/include"
    xmlns:xmlmime="http://tempuri.org/xmlmime.xsd"
    xmlns:SCSV1="urn:CS8ServerV1"
    xmlns:SCSV2="urn:CS8ServerV2">
    <SOAP-ENV:Header>
        <SCSV0:sessionId>18638456</SCSV0:sessionId>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <SCSV2:getAllPhysicalIosResponse>
            <data xmlmime:contentType="text/xml">
                <data><xop:Include href="cid:id1"/></data>
            </data>
        </SCSV2:getAllPhysicalIosResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--==pj+EhsWuSQJxx7przmb8HM+ZkeNcG3HezSNID7LmfDa9J4lfdUL8W1F7TNJK==
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-ID: <id1>

<?xml version="1.0" encoding="utf-8"?>
<PhysicalIos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.staubli.com/robotics/PhysicalIos/1" >
    <Io name="usrIn0" desc="" type="din" />
    <Io name="usrIn1" desc="" type="din" />
    <Io name="MOTOR_1_3_5" desc="" type="din" />
    <Io name="MOTOR_2_4_6" desc="" type="din" />
    <Io name="CASTING" desc="" type="din" />
    <Io name="DSI_BOARD" desc="" type="din" />
    <Io name="GLOBAL_PTC" desc="" type="din" />
    <Io name="fIn0" desc="" type="din" />
    <Io name="fIn1" desc="" type="din" />
    <Io name="SECTEUR_OK" desc="" type="din" />
    <Io name="valve1" desc="" type="dout" />
    <Io name="valve2" desc="" type="dout" />
    <Io name="fOut0" desc="" type="dout" />
    <Io name="CBT_TEMP" desc="" type="ain" />
    <Io name="CPU_TEMP" desc="" type="ain" />
    <Io name="Socket\test" desc="" type="socketClient" />
</PhysicalIos>

--==pj+EhsWuSQJxx7przmb8HM+ZkeNcG3HezSNID7LmfDa9J4lfdUL8W1F7TNJK==--

SOAP 障害

SOAP 1.2 fault: SOAP-ENV:Sender [no subcode]
"End of file or no input: Operation interrupted or timed out"
Detail: [no detail] 

SOAP エラー コード= SOAP_EOF (== -1)

多分誰かが私のせいを見ますか?

情報が不足している場合は、お気軽にコメントしてください。

前もって感謝します!

編集1

gSOAP 接続もログに記録しました。関連するログ エントリは次のとおりです。

HTTP status: HTTP/1.1 200 OK
HTTP header: Server: gSOAP/2.7
HTTP header: Content-Type: multipart/related; boundary="==IhAUx7qlRoBMWpLHXMvxVdaVBbhA+poanGC1U/anZjRVQ4oRZshmeOhwc+Zx=="; type="application/xop+xml"; start="<SOAP-ENV:Envelope>"; start-info="application/soap+xml; charset=utf-8"
../soaptest/source/stdsoap2.cpp(7330): malloc(224) = 0xbe6290
../soaptest/source/stdsoap2.cpp(7330): malloc(88) = 0xab3170
../soaptest/source/stdsoap2.cpp(7330): malloc(40) = 0xbe5ae0
HTTP header: Transfer-Encoding: chunked
HTTP header: Connection: keep-alive
Finished HTTP header parsing, status = 200
Keep alive connection = 1
Getting chunk size (idx=307 len=307)
Read 5 bytes from socket=21/fd=0
Chunk size = 81E (hex)
Moving buf len to idx=5 len=2083 (81E)
Passed end of buffer for chunked HTTP (0 bytes left)
Getting chunk: read 1448 bytes
../soaptest/source/stdsoap2.cpp(7330): malloc(96) = 0xab2ef0
MIME header: Content-Type: application/xop+xml; charset=utf-8; type="application/soap+xml; charset=utf-8"
../soaptest/source/stdsoap2.cpp(7330): malloc(104) = 0xbe6380
MIME header: Content-Transfer-Encoding: binary
MIME header: Content-ID: <SOAP-ENV:Envelope>
../soaptest/source/stdsoap2.cpp(7330): malloc(40) = 0xbe63f0
XML PI <?xml version="1.0" encoding="UTF-8"?>
Switching to utf-8 encoding
../soaptest/source/stdsoap2.cpp(10357): malloc(62) = 0xbe5d60
Enlarging look-aside buffer to append data, old size=0, new size=256
../soaptest/source/stdsoap2.cpp(10160): malloc(256) = 0xaf89e0
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xaf8c00
../soaptest/source/stdsoap2.cpp(2735): malloc(40) = 0xbe64e0
Push namespace binding (level=0) 'SOAP-ENV' 'http://www.w3.org/2003/05/soap-envelope'
Push OK ('SOAP-ENV' matches 'SOAP-ENV' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(62) = 0xbe5b40
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe5340
../soaptest/source/stdsoap2.cpp(2735): malloc(40) = 0xbe65a0
Push namespace binding (level=0) 'SOAP-ENC' 'http://www.w3.org/2003/05/soap-encoding'
Push OK ('SOAP-ENC' matches 'SOAP-ENC' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(57) = 0xbe5920
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe5560
../soaptest/source/stdsoap2.cpp(2735): malloc(35) = 0xbe6660
Push namespace binding (level=0) 'xsi' 'http://www.w3.org/2001/XMLSchema-instance'
Push OK ('xsi' matches 'xsi' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(57) = 0xbe5700
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe5780
../soaptest/source/stdsoap2.cpp(2735): malloc(35) = 0xbe6720
Push namespace binding (level=0) 'xsd' 'http://www.w3.org/2001/XMLSchema'
Push OK ('xsd' matches 'xsd' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(59) = 0xbe54e0
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe59a0
../soaptest/source/stdsoap2.cpp(2735): malloc(37) = 0xbe67e0
Push namespace binding (level=0) 'SCSV0' 'CS8ServerV0'
Push OK ('SCSV0' matches 'ns1' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(57) = 0xaf8da0
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe5bc0
../soaptest/source/stdsoap2.cpp(2735): malloc(35) = 0xbe68a0
Push namespace binding (level=0) 'xop' 'http://www.w3.org/2004/08/xop/include'
Push OK ('xop' matches 'ns3' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(61) = 0xaf8b80
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe5de0
../soaptest/source/stdsoap2.cpp(2735): malloc(39) = 0xbe6960
Push namespace binding (level=0) 'xmlmime' 'http://tempuri.org/xmlmime.xsd'
Push OK ('xmlmime' matches 'ns5' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(59) = 0xab2e70
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe6000
../soaptest/source/stdsoap2.cpp(2735): malloc(37) = 0xbe6a20
Push namespace binding (level=0) 'SCSV1' 'urn:CS8ServerV1'
Push OK ('SCSV1' matches 'ns2' in namespace table)
../soaptest/source/stdsoap2.cpp(10357): malloc(59) = 0xbe6a80
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xab3030
../soaptest/source/stdsoap2.cpp(2735): malloc(37) = 0xbe6b30
Push namespace binding (level=0) 'SCSV2' 'urn:CS8ServerV2'
Push OK ('SCSV2' matches 'ns6' in namespace table)
Tags and (default) namespaces match: 'SOAP-ENV:Envelope' 'SOAP-ENV:Envelope'
Begin element found (level=1) 'SOAP-ENV:Envelope'='SOAP-ENV:Envelope'
../soaptest/source/stdsoap2.cpp(14903): malloc(40) = 0xbe6b90
Tags and (default) namespaces match: 'SOAP-ENV:Header' 'SOAP-ENV:Header'
Begin element found (level=2) 'SOAP-ENV:Header'='SOAP-ENV:Header'
Enter id='' type=296 loc=(nil) size=8 level=0
../soaptest/source/stdsoap2.cpp(7330): malloc(32) = 0xbe6bf0
Tags and (default) namespaces match: 'SCSV0:sessionId' 'ns1:sessionId'
Begin element found (level=3) 'SCSV0:sessionId'='ns1:sessionId'
Reverting to last element 'SCSV0:sessionId' (level=2)
Tags and (default) namespaces match: 'SCSV0:sessionId' 'ns1:sessionId'
Begin element found (level=3) 'SCSV0:sessionId'='ns1:sessionId'
Enter id='' type=206 loc=(nil) size=4 level=0
../soaptest/source/stdsoap2.cpp(7330): malloc(24) = 0xbe6c50
Element content value='18714240'
End element found (level=3) 'SCSV0:sessionId'='ns1:sessionId'
End element found (level=2) 'SOAP-ENV:Header'='SOAP-ENV:Header'
Tags and (default) namespaces match: 'SOAP-ENV:Body' 'SOAP-ENV:Body'
Begin element found (level=2) 'SOAP-ENV:Body'='SOAP-ENV:Body'
Tags and (default) namespaces match: 'SCSV2:getAllPhysicalIosResponse' 'ns6:getAllPhysicalIosResponse'
Begin element found (level=3) 'SCSV2:getAllPhysicalIosResponse'='ns6:getAllPhysicalIosResponse'
Enter id='' type=166 loc=0xab3010 size=24 level=0
../soaptest/source/stdsoap2.cpp(10357): malloc(67) = 0xbe6ca0
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe6d20
Tags match: 'data' 'data'
Begin element found (level=4) 'data'='data'
Reverting to last element 'data' (level=3)
soap_instantiate_ns6__MimeData(-1, , )
../soaptest/source/stdsoap2.cpp(7617): malloc(32) = 0xbe6e60
Instantiated location=0xbe6ec0
Tags match: 'data' 'data'
Begin element found (level=4) 'data'='data'
Enter id='' type=97 loc=0xbe6ec0 size=80 level=0
Tags and (default) namespaces match: 'xmlmime:contentType' 'ns5:contentType'
../soaptest/source/stdsoap2.cpp(7330): malloc(32) = 0xbe6f20
soap_instantiate_std__string(-1, , )
../soaptest/source/stdsoap2.cpp(7617): malloc(32) = 0xbe6f80
Instantiated location=0xbe6fe0
Tags match: 'data' 'data'
Begin element found (level=5) 'data'='data'
Enter id='' type=10 loc=0xbe6ec8 size=56 level=0
../soaptest/source/stdsoap2.cpp(10357): malloc(52) = 0xbe7030
../soaptest/source/stdsoap2.cpp(10412): malloc(256) = 0xbe70a0
Tags 'xop:Include' and 'xop:Include' match but namespaces differ
End element found (level=5) 'data'='data'
End element found (level=4) 'SCSV2:getAllPhysicalIosResponse'='data'
End element found (level=3) 'SOAP-ENV:Body'='ns6:getAllPhysicalIosResponse'
End element found (level=2) 'SOAP-ENV:Envelope'='SOAP-ENV:Body'
XML PI <?xml version="1.0" encoding="utf-8"?>
Switching to utf-8 encoding
Getting chunk: read 630 bytes
Read 7 bytes (chunked) from socket 21
Getting chunk size (idx=0 len=7)
Chunk size = 0 (hex)
End of chunked message
Shutdown socket 21 how=2
Close socket 21
soap_instantiate_SOAP_ENV__Fault(-1, , )
../soaptest/source/stdsoap2.cpp(7617): malloc(32) = 0xbe71e0
Instantiated location=0xbe7240
soap_instantiate_SOAP_ENV__Code(-1, , )
../soaptest/source/stdsoap2.cpp(7617): malloc(32) = 0xbe7290
Instantiated location=0xbe72f0
soap_instantiate_SOAP_ENV__Reason(-1, , )
../soaptest/source/stdsoap2.cpp(7617): malloc(32) = 0xbe7310
Instantiated location=0xbe7370

解決

そこで、ログ ファイルを 1 行ずつ調べたところ、興味深いことがわかりました。関連する行:

Tags 'xop:Include' and 'xop:Include' match but namespaces differ

これは、soap が応答内の idx フィールドを解析しないことを意味します。代わりに以下を使用します。

MIME header: Content-ID: <SOAP-ENV:Envelope>

これは間違いなく間違っています。

だから私は、サーバーが使用している XML 名前空間に何か問題があるに違いないと考えました。名前空間の障害を無視することで機能します。

ソケット接続には次の IO_MODE を使用しました: #define MY_IO_MODE (IO_MODE | SOAP_ENC_MTOM | SOAP_XML_IGNOREN)

これでかなり見栄えが良くなりました:

MIME header: Content-ID: <id1>

format/famespace エラーを無視するのは良いプログラミング スタイルではないことを知っていたにもかかわらず、サーバー側に影響を与えないため、それらを維持するしかありませんでした。

すべての読者に感謝します!

4

1 に答える 1