消费闷棍的WebService - 请求发送两次,每次失败时 [英] Consuming Sap WebService - request sent twice and fails every time
问题描述
我我挣扎了一下与消耗汁液web服务。我经历过很多教程,并在MSDN上的多个线程,但我不能找到我的问题的解决方案:
运行我的计划与此错误结束:
不是的CommunicationException处理。
- >未知Messageversion
System.ServiceModel.CommunicationException wurde nicht behandelt。
HResult的= -2146233087
消息= Unbekannte Nachrichtenversion。
来源= mscorlib程序
堆栈跟踪:
服务器堆栈跟踪:
贝System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader读卡器)
贝System.ServiceModel.Channels。 BufferedMessage..ctor(IBufferedMessageData messageData,RecycledMessageState recycledMessageState,布尔[] understoodHeaders,布尔understoodHeadersModified)
贝System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1缓冲,bufferManager bufferManager,字符串的contentType)
贝System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1缓冲,流的InputStream)
贝System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(流的InputStream)
贝System.ServiceModel.Channels.HttpInput .ParseIncomingMessage(HttpRequestMessage httpRequestMessage,异常和放大器; requestException)
贝System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(时间跨度超时)
贝System.ServiceModel.Channels.RequestChannel.Request(消息消息,时间跨度超时)
贝System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,时间跨度超时)
贝System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔单向,ProxyOperationRuntime操作,对象[]项,对象[]奏,时间跨度超时)
贝System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)
贝System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天消息)在[0]
例外重新抛出:
贝System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天reqMsg,即时聊天retMsg)
贝System.Runtime.Remoting.Proxies.RealProxy .PrivateInvoke(MessageData&安培; MSGDATA,的Int32型)
贝ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gut.ZTST_MASS_USER_CREATE(ZTST_MASS_USER_CREATERequest要求)
贝ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gutClient.ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gut.ZTST_MASS_USER_CREATE(ZTST_MASS_USER_CREATERequest要求)在C:\Users\\ \\tstaat\documents\visual工作室2010\Projects\ConsoleApplication1\ConsoleApplication1\Service References\ServiceReference2\Reference.cs:Zeile 138
贝ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gutClient.ZTST_MASS_USER_CREATE(ZTST_USER_PWD [ ] USER)在C:\Users\tstaat\documents\visual工作室2010\Projects\ConsoleApplication1\ConsoleApplication1\Service References\ServiceReference2\Reference.cs:Zeile 144
贝ConsoleApplication1.Program.Main(字串[] args)在C:\Users\tstaat\documents\visual工作室2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:Zeile 61
贝System.AppDomain._nExecuteAssembly(RuntimeAssembly组装,字串[] args)
贝System.AppDomain.ExecuteAssembly(字符串assemblyFile,证据assemblySecurity,字串[] args)
贝Microsoft.VisualStudio.HostingProcess.HostProc。 RunUsersAssembly()
贝System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
贝System.Threading.ExecutionContext.RunInternal(ExecutionContext中的ExecutionContext,ContextCallback回调,对象状态,布尔preserveSyncCtx)
贝系统.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象状态,布尔preserveSyncCtx)
贝System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态)
贝的System.Threading。 ThreadHelper.ThreadStart()
的InnerException:
什么似乎不可思议我说:
我测试过了SoapUI创建的请求。我不得不删除的评论,然后正常工作:
< soapenv:信封的xmlns:soapenv =HTTP:// schemas.xmlsoap.org/soap/envelope/的xmlns:瓮=瓮:SAP-COM:文档:SAP:RFC:功能>
< soapenv:页眉/>
< soapenv:身体与GT;
<金塔:ZTST_MASS_USER_CREATE>
<使用者>
<项目>
<! - 删除评论 - >
<使用者> O< /使用者名称>
< PWD>&KKKK LT; / PWD>
< /项目>
< /使用者名称>
< /金塔:ZTST_MASS_USER_CREATE>
< / soapenv:身体与GT;
< / soapenv:信封>
所以最后我的代码看起来是这样的:
VAR约束力=新basicHttpBinding的();
binding.MaxReceivedMessageSize = int.MaxValue;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.AllowCookies = TRUE;
变种地址=新的EndpointAddress(HTTP://主机/ relativeurn);
//创建客户
ServiceReference2.ZTST_MASS_CREATE_USER_gutClient客户端=新ServiceReference2.ZTST_MASS_CREATE_USER_gutClient(绑定,地址);
Console.WriteLine(创建客户);
//定义凭证
client.ClientCredentials.UserName.UserName =用户 ;
client.ClientCredentials.UserName.Password =PWD;
ServiceReference2.ZTST_USER_PWD []参数=新ServiceReference2.ZTST_USER_PWD [2];
参数。初始化();
参数[] =什么
client.open();
参数= client.ZTST_MASS_USER_CREATE(参数);
第二个错误是,对Web服务请求发送两次:一次用,一次不带authentfication
它不适合完全对我来说,事业上
参数= client.ZTST_MASS_USER_CREATE(参数);
我的两个请求程序;第二个是由服务器(先不进行身份验证)接受,但返回一个错误:
< XML ?版本=1.0编码=UTF-8>
< WSDL:定义的targetNamespace =瓮:SAP-COM:文档:SAP:RFC:功能的xmlns:WSDL =http://schemas.xmlsoap.org/wsdl/的xmlns:XSD =HTTP ://www.w3.org/2001/XMLSchema的xmlns:SOAP =http://schemas.xmlsoap.org/wsdl/soap/的xmlns:HTTP =http://schemas.xmlsoap.org/wsdl/ HTTP /的xmlns:哑剧=http://schemas.xmlsoap.org/wsdl/mime/的xmlns:TNS =瓮:SAP-COM:文档:SAP:RFC:功能的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>
< WSDL:文件>
< SIDL:SIDL的xmlns:SIDL =http://www.sap.com/2007/03/sidl/>
< / WSDL:文件>
< WSP:UsingPolicy WSDL:所需=真/>
< WSP:政策WSU:ID =BN_BN_ZTST_MASS_CREATE_USER>
< saptrnbnd:OptimizedXMLTransfer URI =http://xml.sap.com/2006/11/esi/esp/binxml的xmlns:saptrnbnd =http://www.sap.com/webas/710 / SOAP /功能/ transportbinding /WSP:可选=真/>
< saptrnbnd:OptimizedXMLTransfer URI =http://www.w3.org/2004/08/soap/features/http-optimization的xmlns:saptrnbnd =http://www.sap.com/webas / 710 / SOAP /功能/ transportbinding /WSP:可选=真/>
< WSP:ExactlyOne上的xmlns:WSP =http://schemas.xmlsoap.org/ws/2004/09/policy的xmlns:sapsp =http://www.sap.com/webas/630 / SOAP /功能/安全/政策的xmlns:SP =http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702的xmlns:WSA =http://www.w3.org / 2005/08 /寻址的xmlns:WST =http://docs.oasis-open.org/ws-sx/ws-trust/200512的xmlns:WSU =http://schemas.xmlsoap.org/ws / 2002/07 /实用工具的xmlns:WSX =http://schemas.xmlsoap.org/ws/2004/09/mex>
< WSP:所有与GT;
< SP:TransportBinding>
< WSP:政策>
< SP:TransportToken>
< WSP:政策>
< SP:HttpsToken>
< WSP:政策>
< SP:HttpBasicAuthentication />
< / WSP:政策>
< / SP:HttpsToken>
< / WSP:政策>
< / SP:TransportToken>
< SP:AlgorithmSuite>
< WSP:政策>
< SP:TripleDesRsa15 />
< / WSP:政策>
< / SP:AlgorithmSuite>
< SP:布局>
< WSP:政策>
< SP:严格/>
< / WSP:政策>
< / SP:布局>
< / WSP:政策>
< / SP:TransportBinding>
< / WSP:所有与GT;
< / WSP:ExactlyOne上>
< / WSP:政策>
< WSP:政策WSU:ID =IF_IF_ZTST_MASS_CREATE_USER_gut>
< sapsession:会话的xmlns:sapsession =http://www.sap.com/webas/630/soap/features/session/>
< sapsession:enableSession>假LT; / sapsession:enableSession>
< / sapsession:会话>
< sapcentraladmin:CentralAdministration的xmlns:sapcentraladmin =http://www.sap.com/webas/700/soap/features/CentralAdministration/WSP:可选=真正的>#
< ; sapcentraladmin:BusinessApplicationID> 3EB6184C46517B16E1000000AC10FEEB< / sapcentraladmin:BusinessApplicationID>
< / sapcentraladmin:CentralAdministration>
< / WSP:政策>
< WSP:政策WSU:ID =OP_IF_OP_ZTST_MASS_USER_CREATE>
< sapcomhnd:enableCommit的xmlns:sapcomhnd =http://www.sap.com/NW05/soap/features/commit/>假LT; / sapcomhnd:enableCommit>
< sapblock:enableBlocking的xmlns:sapblock =http://www.sap.com/NW05/soap/features/blocking/>真< / sapblock:enableBlocking>
< saptrhnw05:需要的xmlns:saptrhnw05 =http://www.sap.com/NW05/soap/features/transaction/>无< / saptrhnw05:要求>
< saprmnw05:enableWSRM的xmlns:saprmnw05 =http://www.sap.com/NW05/soap/features/wsrm/>假LT; / saprmnw05:enableWSRM>
< / WSP:政策>
< WSDL:类型>
< XSD:模式attributeFormDefault =合格的targetNamespace =瓮:SAP-COM:文档:SAP:RFC:功能>
< XSD:简单类型名称=char12>
< XSD:限制基地=XSD:字符串>
< XSD:最大长度值=12/>
< / XSD:限制>
< / XSD:简单类型>
< XSD:简单类型名称=char40>
< XSD:限制基地=XSD:字符串>
< XSD:最大长度值=40/>
< / XSD:限制>
< / XSD:简单类型>
< XSD:复杂类型名称=ZTST_USER_PWD>
< XSD:序列>
< XSD:元素名称=USERTYPE =TNS:char12/>
< XSD:元素名称=PWDTYPE =TNS:char40/>
< / XSD:序列>
< /为xsd:复杂类型>
< XSD:复杂类型名称=ZTST_USER_PWD_TAB>
< XSD:序列>
< XSD:元素名称=项目式=TNS:ZTST_USER_PWD的minOccurs =0的maxOccurs =无界/>
< / XSD:序列>
< /为xsd:复杂类型>
< XSD:元素名称=ZTST_MASS_USER_CREATE>
< XSD:复杂类型>
< XSD:序列>
< XSD:元素名称=USERTYPE =TNS:ZTST_USER_PWD_TAB/>
< / XSD:序列>
< /为xsd:复杂类型>
< / XSD:组件>
< XSD:元素名称=ZTST_MASS_USER_CREATEResponse>
< XSD:复杂类型>
< XSD:序列>
< XSD:元素名称=OUT_TABTYPE =TNS:ZTST_USER_PWD_TAB/>
< / XSD:序列>
< /为xsd:复杂类型>
< / XSD:组件>
< / XSD:架构>
< / WSDL:类型>
< WSDL:消息名称=ZTST_MASS_USER_CREATE>
< WSDL:部分名称=参数元素=TNS:ZTST_MASS_USER_CREATE/>
< / WSDL:消息>
< WSDL:消息名称=ZTST_MASS_USER_CREATEResponse>
< WSDL:部分名称=参数元素=TNS:ZTST_MASS_USER_CREATEResponse/>
< / WSDL:消息>
< WSDL:portType的名称=ZTST_MASS_CREATE_USER_gut>
< WSP:政策>
< WSP:PolicyReference URI =#IF_IF_ZTST_MASS_CREATE_USER_gut/>
< / WSP:政策>
< WSDL:操作名称=ZTST_MASS_USER_CREATE>
< WSP:政策>
< WSP:PolicyReference URI =#OP_IF_OP_ZTST_MASS_USER_CREATE/>
< / WSP:政策>
< WSDL:输入消息=TNS:ZTST_MASS_USER_CREATE/>
< WSDL:输出消息=TNS:ZTST_MASS_USER_CREATEResponse/>
< / WSDL:运转>
< / WSDL:portType的>
< WSDL:绑定名称=ZTST_MASS_CREATE_USERTYPE =TNS:ZTST_MASS_CREATE_USER_gut>
< WSP:政策>
< WSP:PolicyReference URI =#BN_BN_ZTST_MASS_CREATE_USER/>
< / WSP:政策>
<肥皂:绑定传输=http://schemas.xmlsoap.org/soap/http的风格=文件/>
< WSDL:操作名称=ZTST_MASS_USER_CREATE>
<肥皂:操作的soapAction =的风格=文件/>
< WSDL:输入>
<肥皂:身体使用=文字/>
< / WSDL:输入>
< WSDL:输出>
<肥皂:身体使用=文字/>
< / WSDL:输出>
< / WSDL:运转>
< / WSDL:结合>
< WSDL:服务名称=ZTST_MASS_CREATE_USER>
< WSDL:端口名称=ZTST_MASS_CREATE_USER绑定=TNS:ZTST_MASS_CREATE_USER>
<肥皂:地址位置=HTTP://东西/>
< / WSDL:端口>
< / WSDL:服务>
< / WSDL:定义>
更新:
这是我的appl.config
<?XML版本=1.0编码=UTF-8? >
<结构>
< system.serviceModel>
<&绑定GT;
< customBinding>
<绑定名称=ZTST_MASS_CREATE_USER>
< httpTransport authenticationScheme =基本/>
< /&结合GT;
< / customBinding>
< /绑定>
<客户端>
<端点地址=HTTP://,某/ relativeblabla
结合=customBindingbindingConfiguration =ZTST_MASS_CREATE_USER
合同=ServiceReference2.ZTST_MASS_CREATE_USER_gutNAME =ZTST_MASS_CREATE_USER/> ;
< /客户>
< /system.serviceModel>
< /结构>
愚蠢的我!错误,如果你选择添加服务引用,而不是Web服务引用,当你需要一个Web服务引用上面会发生。对于添加webREferenz到项目:
i'm strugglin a bit with consuming a sap webservice. I've been through many tutorials and also many threads on msdn, but i cannot find a solution for my Problem:
Running my Programme ends up with this error:
CommunicationException not handled.
-> unknown Messageversion
System.ServiceModel.CommunicationException wurde nicht behandelt.
HResult=-2146233087
Message=Unbekannte Nachrichtenversion.
Source=mscorlib
StackTrace:
Server stack trace:
bei System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader reader)
bei System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders, Boolean understoodHeadersModified)
bei System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
bei System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
bei System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
bei System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(HttpRequestMessage httpRequestMessage, Exception& requestException)
bei System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
bei System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
bei System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
bei System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
bei System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
bei System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
bei ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gut.ZTST_MASS_USER_CREATE(ZTST_MASS_USER_CREATERequest request)
bei ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gutClient.ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gut.ZTST_MASS_USER_CREATE(ZTST_MASS_USER_CREATERequest request) in C:\Users\tstaat\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Service References\ServiceReference2\Reference.cs:Zeile 138.
bei ConsoleApplication1.ServiceReference2.ZTST_MASS_CREATE_USER_gutClient.ZTST_MASS_USER_CREATE(ZTST_USER_PWD[] USER) in C:\Users\tstaat\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Service References\ServiceReference2\Reference.cs:Zeile 144.
bei ConsoleApplication1.Program.Main(String[] args) in C:\Users\tstaat\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:Zeile 61.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
What seems weird to me:
I tested the request created through SoapUI. I had to erase the comments, then it works fine:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions">
<soapenv:Header/>
<soapenv:Body>
<urn:ZTST_MASS_USER_CREATE>
<USER>
<item>
<!-- erased comment -->
<USER>o</USER>
<PWD>kkkk</PWD>
</item>
</USER>
</urn:ZTST_MASS_USER_CREATE>
</soapenv:Body>
</soapenv:Envelope>
So finally my code looks like this:
var binding = new BasicHttpBinding();
binding.MaxReceivedMessageSize = int.MaxValue;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.AllowCookies = true;
var address = new EndpointAddress("http://host/relativeurn);
//create client
ServiceReference2.ZTST_MASS_CREATE_USER_gutClient client = new ServiceReference2.ZTST_MASS_CREATE_USER_gutClient(binding, address);
Console.WriteLine("Created Client");
//define credentials
client.ClientCredentials.UserName.UserName = "User";
client.ClientCredentials.UserName.Password = "PWD";
ServiceReference2.ZTST_USER_PWD[] parameter = new ServiceReference2.ZTST_USER_PWD[2];
parameter.Initialize();
parameter[] = something
client.open();
parameter = client.ZTST_MASS_USER_CREATE(parameter);
The second error is that the request to the webservice is sent twice: once with and once without authentfication.
I went through this thread: http://social.msdn.microsoft.com/Forums/vstudio/en-US/d9f99777-f702-4c0e-8198-b110f8eacdd9/net-c-console-application-calling-sap-webservice?forum=wcf
It doesn't fit exactly for me, cause on
parameter = client.ZTST_MASS_USER_CREATE(parameter);
my programme for two requests; the second one is accepted by the server (the first doesn't authenticate), but returns an error:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 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">
<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_BN_ZTST_MASS_CREATE_USER">
<saptrnbnd:OptimizedXMLTransfer uri="http://xml.sap.com/2006/11/esi/esp/binxml" xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" wsp:Optional="true"/>
<saptrnbnd:OptimizedXMLTransfer uri="http://www.w3.org/2004/08/soap/features/http-optimization" xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" wsp:Optional="true"/>
<wsp:ExactlyOne xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sapsp="http://www.sap.com/webas/630/soap/features/security/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsp:All>
<sp:TransportBinding>
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken>
<wsp:Policy>
<sp:HttpBasicAuthentication/>
</wsp:Policy>
</sp:HttpsToken>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:TripleDesRsa15/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
</wsp:Policy>
</sp:TransportBinding>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="IF_IF_ZTST_MASS_CREATE_USER_gut">
<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>3EB6184C46517B16E1000000AC10FEEB</sapcentraladmin:BusinessApplicationID>
</sapcentraladmin:CentralAdministration>
</wsp:Policy>
<wsp:Policy wsu:Id="OP_IF_OP_ZTST_MASS_USER_CREATE">
<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>
<saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required>
<saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM>
</wsp:Policy>
<wsdl:types>
<xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<xsd:simpleType name="char12">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char40">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ZTST_USER_PWD">
<xsd:sequence>
<xsd:element name="USER" type="tns:char12"/>
<xsd:element name="PWD" type="tns:char40"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ZTST_USER_PWD_TAB">
<xsd:sequence>
<xsd:element name="item" type="tns:ZTST_USER_PWD" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ZTST_MASS_USER_CREATE">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="USER" type="tns:ZTST_USER_PWD_TAB"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZTST_MASS_USER_CREATEResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="OUT_TAB" type="tns:ZTST_USER_PWD_TAB"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ZTST_MASS_USER_CREATE">
<wsdl:part name="parameters" element="tns:ZTST_MASS_USER_CREATE"/>
</wsdl:message>
<wsdl:message name="ZTST_MASS_USER_CREATEResponse">
<wsdl:part name="parameters" element="tns:ZTST_MASS_USER_CREATEResponse"/>
</wsdl:message>
<wsdl:portType name="ZTST_MASS_CREATE_USER_gut">
<wsp:Policy>
<wsp:PolicyReference URI="#IF_IF_ZTST_MASS_CREATE_USER_gut"/>
</wsp:Policy>
<wsdl:operation name="ZTST_MASS_USER_CREATE">
<wsp:Policy>
<wsp:PolicyReference URI="#OP_IF_OP_ZTST_MASS_USER_CREATE"/>
</wsp:Policy>
<wsdl:input message="tns:ZTST_MASS_USER_CREATE"/>
<wsdl:output message="tns:ZTST_MASS_USER_CREATEResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZTST_MASS_CREATE_USER" type="tns:ZTST_MASS_CREATE_USER_gut">
<wsp:Policy>
<wsp:PolicyReference URI="#BN_BN_ZTST_MASS_CREATE_USER"/>
</wsp:Policy>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="ZTST_MASS_USER_CREATE">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ZTST_MASS_CREATE_USER">
<wsdl:port name="ZTST_MASS_CREATE_USER" binding="tns:ZTST_MASS_CREATE_USER">
<soap:address location="http://something"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
update:
THIS is my appl.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="ZTST_MASS_CREATE_USER">
<httpTransport authenticationScheme="Basic" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://somehost/relativeblabla"
binding="customBinding" bindingConfiguration="ZTST_MASS_CREATE_USER"
contract="ServiceReference2.ZTST_MASS_CREATE_USER_gut" name="ZTST_MASS_CREATE_USER" />
</client>
</system.serviceModel>
</configuration>
Stupid me! The errors above will happen if you choose add service Reference instead of Web Service Reference, when you need a WEB SERVICE REFERENCE. For adding a webREferenz to your project:
这篇关于消费闷棍的WebService - 请求发送两次,每次失败时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!