Я программирую интерфейс для контроллера Staeubli Robot Controller (CS8). Все работает ровно, пока я не попробую запросить информацию об IO. Запрос заканчивается SOAP_EOF. Я попробовал еще несколько запросов, и все они работают нормально. Таким образом, я захватил пакеты отправки/получения, и единственная разница между хорошими запросами и плохим - это тип ответа mime. Вот запрос/ответ на плохой:gSOAP response EOF (Staeubli CS8)
Запрос
<?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>
Response
--==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)
Возможно, кто-то видит мою ошибку?
Если какая-либо информация отсутствует, пожалуйста, не стесняйтесь комментировать.
Заранее благодарен!
EDIT1
Я также вошли соединения 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
РЕШЕНИЯ
Так я изучал линию лог-файлы по линии и нашел что-то интересное. Связанные линии:
Tags 'xop:Include' and 'xop:Include' match but namespaces differ
Это означает, что мыло не анализирует поле 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>
Несмотря зная, что игнорирование/формат ошибок famespace это не хороший стиль программирования, у меня не было выбора, кроме как сохранить их, поскольку я не влияю на серверную сторону.
Спасибо всем читателям!
Я обновил мою версию gsoap до 2,8.16, установил таймауты на 10 секунд (которые перестают недоступны), но ничего не помогает. Наконец я нашел решение. Я обновлю свой вопрос выше. Спасибо вам всем. – user2957270