Hi all,
I created and activated a service . I created a FM to execute it , but then I got a error 'SOAP:1,032 SRT: Wrong Content-Type and empty HTTP-Body received' . I really dont know what could be wrong with my WS and how to solve this issue. Any idea?
I tested the service in soapui and it was ok
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fil="http://fnws.eai.cnpc.com/FilenetService">
<soapenv:Header xmlns:fil="http://fnws.eai.cnpc.com/FilenetService">
<fil:header >
<fil:username>fngcdadm</fil:username>
<fil:password>mybasis0</fil:password>
<fil:objectstore>TestOS1</fil:objectstore>
<fil:caller>test</fil:caller>
</fil:header>
</soapenv:Header>
<soapenv:Body>
<fil:uploadreq>
<fil:doc classname="ContractDocument">
<fil:guid/>
<fil:path>/Test/ZBZZ</fil:path>
<fil:name>2.txt</fil:name>
<fil:title>TEST</fil:title>
<fil:crtuser>TEST</fil:crtuser>
<fil:organization>TEST</fil:organization>
<fil:busiguid>TEST</fil:busiguid>
<fil:busitype>00000001</fil:busitype>
<fil:busistate>1</fil:busistate>
<fil:content>MTIzDQozMzM=</fil:content>
<fil:parameters>
<!--1 or more repetitions:-->
</fil:parameters>
<fil:sysparams>
</fil:sysparams>
</fil:doc>
</fil:uploadreq>
</soapenv:Body>
</soapenv:Envelope>
The FM code:
*"----------------------------------------------------------------------
*"*"Local interface:
*" EXPORTING
*" VALUE(E_GUID) TYPE ZC70_GUID
*" VALUE(E_MSG) TYPE STRING
*"----------------------------------------------------------------------
DATA: lo_proxy TYPE REF TO zc70_co_filenet_service_port_t,
l_out TYPE zc70_upload_request,
l_doc TYPE zc70_doc,
l_parameters TYPE zc70_parameters,
lt_parameter TYPE zc70_parameter_tab,
ls_parameter TYPE zc70_parameter,
ls_sysparams TYPE zc70_sysparams,
l_in TYPE zc70_upload_response,
l_guid TYPE zc70_guid,
lo_fault TYPE REF TO cx_ai_system_fault.
"声明消息头header文件
DATA: ws_header TYPE REF TO if_wsprotocol_ws_header,
name TYPE string,
namespace TYPE string.
DATA: ixml TYPE REF TO if_ixml,
xml_document TYPE REF TO if_ixml_document,
xml_root TYPE REF TO if_ixml_element,
xml_element TYPE REF TO if_ixml_element,
xml_node TYPE REF TO if_ixml_node.
DATA: l_xstring TYPE xstring.
DATA: l_string TYPE string.
FIELD-SYMBOLS <fs_xstring> TYPE xstring.
* ls_parameter-key = 'MATNR'.
* ls_parameter-content = '1001'.
* APPEND ls_parameter TO lt_parameter.
* MOVE lt_parameter TO l_parameters-parameter.
* l_doc-parameters = l_parameters.
l_doc-classname = 'ContractDocument'.
l_doc-path = '/Test/ZBZZ'.
l_doc-name = '2.txt'.
l_doc-title = 'TEST'.
l_doc-crtuser = 'TEST'.
l_doc-organization = 'TEST'.
l_doc-busiguid = 'TEST'.
l_doc-busitype = '00000001'.
l_doc-busistate = '1'.
l_doc-content = 'MTIzDQozMzM='.
MOVE l_doc TO l_out-doc.
TRY.
CREATE OBJECT lo_proxy.
ws_header ?= lo_proxy->get_protocol( if_wsprotocol=>ws_header ).
CONCATENATE
'<soap:Header>'
'<fil:header xmlns:fil="http://fnws.eai.cnpc.com/FilenetService">'" xmlns:fil="http://fnws.eai.cnpc.com/FilenetService/"
'<fil:username>fngcdadm</fil:username>'
'<fil:password>mybasis0</fil:password>'
'<fil:objectstore>TestOS1</fil:objectstore>'
'<fil:caller>test</fil:caller>'
'</fil:header>'
'</soap:Header>'
INTO l_string.
l_xstring = cl_proxy_service=>cstring2xstring( l_string ).
IF NOT l_string IS INITIAL.
CALL FUNCTION 'SDIXML_XML_TO_DOM'
EXPORTING
xml = l_xstring
IMPORTING
document = xml_document
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
IF sy-subrc = 0 AND NOT xml_document IS INITIAL.
xml_root = xml_document->get_root_element( ).
xml_element ?= xml_root->get_first_child( ).
WHILE NOT xml_element IS INITIAL.
name = xml_element->get_name( ).
namespace = xml_element->get_namespace_uri( )."'http://fnws.eai.cnpc.com/FilenetService/' .
IF NOT xml_element IS INITIAL.
ENDIF.
ws_header->set_request_header( name = name namespace = namespace dom = xml_element ).
xml_element ?= xml_element->get_next( ).
ENDWHILE.
ENDIF.
ENDIF.
CALL METHOD lo_proxy->upload
EXPORTING
input = l_out
IMPORTING
output = l_in.
l_guid = l_in-guid .
CATCH cx_ai_system_fault INTO lo_fault.
CALL METHOD lo_fault->if_message~get_text
RECEIVING
result = e_msg.
RETURN.
ENDTRY.
Best Regards
wangyuan