如何在不使用 MSXML 的情况下调用 ASP.Net 制作的 Web 服务?
How can I call a ASP.Net made web service without using MSXML?
我正在使用一种名为“Magik”的非常特殊的语言,我曾经使用 MSXML2 到 运行 网络服务,但在我的一个项目中我没有使用 MSXML,我尝试了很多方法,通过更改 MSXML.DLL 和测试不同版本的 MSXML,使用 MSXMLHttpServer 和所有你可能想到的东西,我不知何故吃了 MSDN 网站,但没有找到任何有用的东西。
现在我正在寻找调用 SOAP 网络服务的其他方式,有人说您可以通过解析和使用查询字符串 post 您的 XML 到网络方法地址,但我没有成功了。
我也可以通过 TCP/IP 进行协商,我可以使用 TCP/IP 连接将我的 XML 发送到 Web 服务吗?
如果有任何其他方法可以完成这项工作,我将不胜感激。
目前我正在将 Magik 连接到一个 Java 应用程序,当我需要调用一个网络服务时,我将我的请求发送到那个 Java 应用程序(有一个 Jar 文件创建了一个数据- Magik 会话和 Java 应用程序之间的总线)我还使用 Axis 技术编写了 Java 部分。但这是一项非常艰巨的工作,我应该改变很多东西来保持我的项目并与我使用的 Web 服务的小变化相匹配。
以前用MSXML好方便,可惜现在不行了!
首先请注意,您不能使用 GET
调用 SOAP
Web 服务,只有 POST
可以与 SOAP
一起使用,GET 可用于 REST
但你只提到了 SOAP
。
我可以向您介绍两种方法,您可以使用它们来调用 Web 服务,而不是调用不再有效的 MSXML。
使用测试表单(Web 服务测试页)
- You may ask your .Net web services provider to create a test form for his own web service and you create a query string which suppose to emulate the data on the form, actually you are using the web services tester page to send your data via query string to it and it will complete the rest for you.
使用 TCPIP
- use a TCP/IP Connection, in this method you need to create a header above your xml to set the parameters that a web service consumer should fill (remember MSXML and Content-Type, Content-Length, SOAPAction, Host, …….)
then translate your string to a byte vector since all programming language which can create a TCPIP Socket just accept a byte vector while inputing or outputing data to that connection. after translating the string you are ready to send the data to your web services address.
take a look at the following example of how you may create a string to send to a TCPIP socket.
POST /globalweather.asmx HTTP/1.1
Host: www.webservicex.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.webserviceX.NET/GetCitiesByCountry"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCitiesByCountry xmlns="http://www.webserviceX.NET">
<CountryName>Egypt</CountryName>
</GetCitiesByCountry>
</soap:Body>
</soap:Envelope>
您可以将以上字符串发送至http://www.webservicex.net/globalweather.asmx
如果您需要有关如何使用 TCPIP 使用 Web 服务的详细信息,您可以查看以下 link
http://www.codeproject.com/Articles/312530/Calling-Webservice-Using-TCP-IP-from-any-Programmi
我正在使用一种名为“Magik”的非常特殊的语言,我曾经使用 MSXML2 到 运行 网络服务,但在我的一个项目中我没有使用 MSXML,我尝试了很多方法,通过更改 MSXML.DLL 和测试不同版本的 MSXML,使用 MSXMLHttpServer 和所有你可能想到的东西,我不知何故吃了 MSDN 网站,但没有找到任何有用的东西。
现在我正在寻找调用 SOAP 网络服务的其他方式,有人说您可以通过解析和使用查询字符串 post 您的 XML 到网络方法地址,但我没有成功了。
我也可以通过 TCP/IP 进行协商,我可以使用 TCP/IP 连接将我的 XML 发送到 Web 服务吗?
如果有任何其他方法可以完成这项工作,我将不胜感激。
目前我正在将 Magik 连接到一个 Java 应用程序,当我需要调用一个网络服务时,我将我的请求发送到那个 Java 应用程序(有一个 Jar 文件创建了一个数据- Magik 会话和 Java 应用程序之间的总线)我还使用 Axis 技术编写了 Java 部分。但这是一项非常艰巨的工作,我应该改变很多东西来保持我的项目并与我使用的 Web 服务的小变化相匹配。 以前用MSXML好方便,可惜现在不行了!
首先请注意,您不能使用 GET
调用 SOAP
Web 服务,只有 POST
可以与 SOAP
一起使用,GET 可用于 REST
但你只提到了 SOAP
。
我可以向您介绍两种方法,您可以使用它们来调用 Web 服务,而不是调用不再有效的 MSXML。
使用测试表单(Web 服务测试页)
- You may ask your .Net web services provider to create a test form for his own web service and you create a query string which suppose to emulate the data on the form, actually you are using the web services tester page to send your data via query string to it and it will complete the rest for you.
使用 TCPIP
- use a TCP/IP Connection, in this method you need to create a header above your xml to set the parameters that a web service consumer should fill (remember MSXML and Content-Type, Content-Length, SOAPAction, Host, …….) then translate your string to a byte vector since all programming language which can create a TCPIP Socket just accept a byte vector while inputing or outputing data to that connection. after translating the string you are ready to send the data to your web services address. take a look at the following example of how you may create a string to send to a TCPIP socket.
POST /globalweather.asmx HTTP/1.1
Host: www.webservicex.net
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.webserviceX.NET/GetCitiesByCountry"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCitiesByCountry xmlns="http://www.webserviceX.NET">
<CountryName>Egypt</CountryName>
</GetCitiesByCountry>
</soap:Body>
</soap:Envelope>
您可以将以上字符串发送至http://www.webservicex.net/globalweather.asmx
如果您需要有关如何使用 TCPIP 使用 Web 服务的详细信息,您可以查看以下 link
http://www.codeproject.com/Articles/312530/Calling-Webservice-Using-TCP-IP-from-any-Programmi