简体   繁体   English

Web服务.NET Framework问题

[英]Web service .NET Framework problem

We are connecting a webservice (java) from C# (VS.Net 2003) application. 我们正在从C#(VS.Net 2003)应用程序连接Web服务(java)。 Web service running on HTTP 1.0 protocol. 在HTTP 1.0协议上运行的Web服务。 On the other hand VS.Net 2003 trying to reach with HTTP 1.1 protocol. 另一方面,VS.Net 2003试图达到HTTP 1.1协议。 Therefore objects are coming null value. 因此,对象变为空值。

For example we are getting string[5] object is correctly but array's items are null value. 例如,我们得到正确的string [5]对象,但数组的项目为空值。

We have to take HTTP protocol to 1.0. 我们必须将HTTP协议设置为1.0。 With 2005 and 2008 no problem. 与2005年和2008年没问题。

How can we do this in VS 2003 framework 1.1 ? 我们如何在VS 2003 Framework 1.1中做到这一点?

Can you get an example of what is expected to be posted for the 1.0 web service call? 您能否获得有关1.0 Web服务调用预期发布的示例? If so, take a look at that and make sure everything is being passed in the soap envelope correctly and any settings that are added to the header. 如果是这样,请查看该内容,并确保所有内容均正确传递到肥皂信封中,并且已将所有设置添加到页眉中。 I just updated an application that can be used to make SOAP calls using a WebRequest and it failed every time you tried to call a 1.1 web service. 我刚刚更新了一个可用于使用WebRequest进行SOAP调用的应用程序,每次尝试调用1.1 Web服务时该应用程序都会失败。 There were multiple problems. 有多个问题。

1) NameSpace 1)命名空间

  - 1.2 = "soap12" 
  - 1.1 = "soap" 

  *Plus, the URL is different for each namespace.

2) ContentType 2)ContentType

  - 1.2 = "application/soap+xml; charset=utf-8"
  - 1.1 = "text/xml; charset=utf-8" 

3) When calling 1.1 web services I had to set the SOAPAction in the header. 3)调用1.1 Web服务时,必须在标头中设置SOAPAction。 Without it, kept getting a 500 error from the server. 没有它,则不断从服务器获取500错误。

I found this out by viewing the automatically generated test page generated by the web service (which has samples of a SOAP 1.1 and 1.2 call). 我是通过查看由Web服务(具有SOAP 1.1和1.2调用示例)自动生成的测试页来发现的。 I then compared it to what we were building as our SOAP envelope / putting in header. 然后,我将其与我们正在构建的SOAP信封/放入标头进行比较。 Once what we were generating matched the example, all worked as expected. 一旦我们生成的内容与示例匹配,所有操作均按预期进行。

Since I do not know how you are calling the Java web service, the above information may or may not be applicable, but at least you have some things to check. 由于我不知道您如何调用Java Web服务,因此上述信息可能适用也可能不适用,但是至少您需要检查一些内容。

If you could post more specific information about how you are making the call to the web service in VS2003 (aka: code example) it would help get a more definitive answer. 如果您可以发布有关如何在VS2003中调用Web服务的更多特定信息(又称代码示例),它将有助于获得更明确的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM