第一步:SE37 创建一个远程函数(Remote Function Module)
注意该函数需要将Remote Enable开启
第二步:创建WebService
首先:SE37 打开需要关联的函数在菜单 Utilities->More Utilities->Create Web Service->From the Function Module 执行
然后:根据引导一步步创建即可
最后:执行SOAMANAGER
选择Web Service Configuration 进行相关配置即可
配置好后
点击上图小车左边的那个图标即可查看对外URL
第三步:初次使用时激活和关闭的相关服务
事务码SICF然后执行进入定义服务页面
需激活
/default_host/sap/bc/soap
– /default_host/sap/bc/srt
– /default_host/sap/bc/srt/rfc/sap
– /default_host/sap/bc/srt/rfc/wsdl
– /default_host/sap/bc/webdynpro/sap
– /default_host/sap/bc/webdynpro/sap/appl_soap_management.
需关闭
若是执行SOAMANAGER事务码提示500 则可关闭一下服务试一下
– /default_host/sap/public/myssocntl
第四步:访问URL
响应如下
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<wsdl:documentation>
<sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl"/>
</wsdl:documentation>
<wsp:UsingPolicy wsdl:required="true"/>
<wsp:Policy wsu:Id="BN__ZABAPWEBSERVICE">
<wsp:ExactlyOne>
<wsp:All>
<sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
<saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true"/>
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
</wsp:All>
<wsp:All>
<sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
<saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/>
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="BN__ZABAPWEBSERVICE_soap12">
<wsp:ExactlyOne>
<wsp:All>
<sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
<saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true"/>
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
</wsp:All>
<wsp:All>
<sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
<saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/>
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="IF__ZWEB">
<wsp:ExactlyOne>
<wsp:All>
<sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/">
<sapsession:enableSession>false</sapsession:enableSession>
</sapsession:Session>
<sapcentraladmin:CentralAdministration xmlns:sapcentraladmin="http://www.sap.com/webas/700/soap/features/CentralAdministration/" wsp:Optional="true">
<sapcentraladmin:BusinessApplicationID>A3238217E7E71EEDAFDCEF9309F89194</sapcentraladmin:BusinessApplicationID>
</sapcentraladmin:CentralAdministration>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="OP__ZABAP_WEBSERVICE_1">
<wsp:ExactlyOne>
<wsp:All>
<saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required>
<sapcomhnd:enableCommit xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/">false</sapcomhnd:enableCommit>
<sapblock:enableBlocking xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/">true</sapblock:enableBlocking>
<saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<xsd:simpleType name="char10">
...
</xsd:simpleType>
<xsd:element name="ZABAP_WEBSERVICE_1">
<xsd:complexType>
<xsd:sequence/>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZABAP_WEBSERVICE_1Response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ZHELLO" type="tns:char10"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ZABAP_WEBSERVICE_1">
<wsdl:part name="parameters" element="tns:ZABAP_WEBSERVICE_1"/>
</wsdl:message>
<wsdl:message name="ZABAP_WEBSERVICE_1Response">
<wsdl:part name="parameter" element="tns:ZABAP_WEBSERVICE_1Response"/>
</wsdl:message>
<wsdl:portType name="ZWEB">
<wsp:Policy>
<wsp:PolicyReference URI="#IF__ZWEB"/>
</wsp:Policy>
<wsdl:operation name="ZABAP_WEBSERVICE_1">
<wsp:Policy>
<wsp:PolicyReference URI="#OP__ZABAP_WEBSERVICE_1"/>
</wsp:Policy>
<wsdl:input message="tns:ZABAP_WEBSERVICE_1"/>
<wsdl:output message="tns:ZABAP_WEBSERVICE_1Response"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZABAPWEBSERVICE" type="tns:ZWEB">
<wsp:Policy>
<wsp:PolicyReference URI="#BN__ZABAPWEBSERVICE"/>
</wsp:Policy>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="ZABAP_WEBSERVICE_1">
<soap:operation soapAction="urn:sap-com:document:sap:rfc:functions:ZWEB:ZABAP_WEBSERVICE_1Request" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ZABAPWEBSERVICE_soap12" type="tns:ZWEB">
<wsp:Policy>
<wsp:PolicyReference URI="#BN__ZABAPWEBSERVICE_soap12"/>
</wsp:Policy>
<wsoap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="ZABAP_WEBSERVICE_1">
<wsoap12:operation soapAction="urn:sap-com:document:sap:rfc:functions:ZWEB:ZABAP_WEBSERVICE_1Request" style="document"/>
<wsdl:input>
<wsoap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsoap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ZABAPWEBSERVICE">
<wsdl:port name="ZABAPWEBSERVICE" binding="tns:ZABAPWEBSERVICE">
<soap:address location="http://vhcalnplci:8000/sap/bc/srt/rfc/sap/zweb/001/zabapwebservice/zabapwebservice"/>
</wsdl:port>
<wsdl:port name="ZABAPWEBSERVICE_soap12" binding="tns:ZABAPWEBSERVICE_soap12">
<wsoap12:address location="http://vhcalnplci:8000/sap/bc/srt/rfc/sap/zweb/001/zabapwebservice/zabapwebservice"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
可能遇到的问题及解决方案
HTTP 500,HTTP403
检查第三步中的服务是否已开启或者关闭
解决需要输入登录账号和密码
在SAP GUI 执行事务码 找到对应的服务
例如这里是ZWEB
把ZWEB 上层的 SAP服务的Login Data设置默认用户
这样就无需输入账号密码也能访问了