WebService   URL:   http://mes:8089/Service.asmx

名字空间:http://tempuri.org/

调用方法:public string UpdateProduceLotTest(string[] TestInfo)

TestInfo[0]:工作中心编号

TestInfo[1]:工位编号

TestInfo[2]:模具代号

TestInfo[3]:产品条码

TestInfo[4]:品质现象编号

TestInfo[5]:测试时间

调用返回一个字符串信息,调用成功返回Success或失败返回Fail。

支持下列操作。有关正式定义,请查看服务说明

·         HelloWorld

·         UpdateProduceLotTest


此 Web 服务使用 http://tempuri.org/ 作为默认命名空间。

建议: 公开 XML Web services 之前,请更改默认命名空间。

每个 XML Web services 都需要一个唯一的命名空间,以便客户端应用程序能够将它与 Web 上的其他服务区分开。http://tempuri.org/ 可用于处于开发阶段的 XML Web services,而已发布的 XML Web services 应使用更为永久的命名空间。

应使用您控制的命名空间来标识 XML Web services。例如,可以使用公司的 Internet 域名作为命名空间的一部分。尽管有许多 XML Web services 命名空间看似 URL,但它们不必指向 Web 上的实际资源。(XML Web services 命名空间为 URI。)

使用 ASP.NET 创建 XML Web services 时,可以使用 WebService 特性的 Namespace 属性更改默认命名空间。WebService 特性适用于包含 XML Web services 方法的类。下面的代码实例将命名空间设置为“http://microsoft.com/webservices/”:

C#

[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
    // 实现
}

Visual Basic

<WebService(Namespace:="http://microsoft.com/webservices/")> Public Class MyWebService
    ' 实现
End Class

C++

[WebService(Namespace="http://microsoft.com/webservices/")]
public ref class MyWebService {
    // 实现
};

HelloWorld

测试

测试窗体只能用于来自本地计算机的请求。

SOAP 1.1

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /Service.asmx HTTP/1.1
Host: mes
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/HelloWorld"
 
<?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>
    <HelloWorld xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?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>
    <HelloWorldResponse xmlns="http://tempuri.org/">
      <HelloWorldResult>string</HelloWorldResult>
    </HelloWorldResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /Service.asmx HTTP/1.1
Host: mes
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <HelloWorld xmlns="http://tempuri.org/" />
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <HelloWorldResponse xmlns="http://tempuri.org/">
      <HelloWorldResult>string</HelloWorldResult>
    </HelloWorldResponse>
  </soap12:Body>
</soap12:Envelope>

UpdateProduceLotTest

测试

测试窗体只能用于来自本地计算机的请求。

SOAP 1.1

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /Service.asmx HTTP/1.1
Host: mes
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/UpdateProduceLotTest"
 
<?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>
    <UpdateProduceLotTest xmlns="http://tempuri.org/">
      <TestInfo>
        <string>string</string>
        <string>string</string>
      </TestInfo>
    </UpdateProduceLotTest>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
 
<?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>
    <UpdateProduceLotTestResponse xmlns="http://tempuri.org/">
      <UpdateProduceLotTestResult>string</UpdateProduceLotTestResult>
    </UpdateProduceLotTestResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /Service.asmx HTTP/1.1
Host: mes
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <UpdateProduceLotTest xmlns="http://tempuri.org/">
      <TestInfo>
        <string>string</string>
        <string>string</string>
      </TestInfo>
    </UpdateProduceLotTest>
  </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <UpdateProduceLotTestResponse xmlns="http://tempuri.org/">
      <UpdateProduceLotTestResult>string</UpdateProduceLotTestResult>
    </UpdateProduceLotTestResponse>
  </soap12:Body>
</soap12:Envelope>

Web_UpdateProduceLotTest.h文件内容如下:

#import   <msxml4.dll>
#include "Singleton.h"
//using   namespace   MSXML2;
#import   "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP30.dll"  exclude( "IStream ",   "ISequentialStream ",   "_LARGE_INTEGER ", "_ULARGE_INTEGER ",   "tagSTATSTG ",   "_FILETIME ")
using   namespace  MSSOAPLib30;
/*#define Web_Uri "http://mes:8089/Service.asmx"
#define Web_NameSpace "http://tempuri.org/"
#define Web_Action "http://tempuri.org/UpdateProduceLotTest"
*/

class CallWebSerVice: public Singleton<CallWebSerVice>
{
public:
    CString   BeginSoap ( CString *TestInfo );
    void SetUrlInfor ( CString strUrl, CString strNamespace );
private:
    CString m_Web_Uri;
    CString m_Web_NameSpace;
    CString m_Web_Action;
};

Web_UpdateProduceLotTest.cpp文件内容如下:

#include "stdafx.h"
#include "Web_UpdateProduceLotTest.h"
#include "CommonDef.h"
CString CallWebSerVice::BeginSoap ( CString *TestInfo )
{
    ISoapConnectorPtr   SoapConnector;
    ISoapSerializerPtr   Serializer;
    ISoapReaderPtr   Reader;

HRESULT   hr;

try
    {
        hr = CoInitialize ( NULL ); //初始化com环境
        if ( FAILED ( hr ) )
        {
            MessageBox ( NULL, TEXT ( "faile" ), TEXT ( "error" ), 0 );
            return L"";
        }
        //创建SoapConnector类的对象
        SoapConnector.CreateInstance ( __uuidof ( HttpConnector30 ) );

//指定Web服务的地址

SoapConnector->Property["EndPointURL"] = m_Web_Uri.GetString();
        SoapConnector->Property["Timeout"] = _variant_t ( ( long ) 4000 );

//与Web服务连接
        hr = SoapConnector-> Connect();
        if ( FAILED ( hr ) )
            return   L"SoapConnector::Connect失败 ";

//指定Web服务完成的操作
        SoapConnector-> Property   ["SoapAction"]   =   m_Web_Action.GetString();
        //准备发送消息给Web服务
        SoapConnector-> BeginMessage();

//   创建SoapSerializer对象
        Serializer.CreateInstance ( __uuidof ( SoapSerializer30 ) );

//   将serializer连接到connector的输入字符串

Serializer-> Init ( _variant_t ( ( IUnknown* ) SoapConnector->InputStream ) );

//   创建SOAP消息
        Serializer-> StartEnvelope ( "", "", "" );
        Serializer-> StartBody ( "" );

Serializer-> StartElement ( "UpdateProduceLotTest", m_Web_NameSpace.GetString(), ( _bstr_t ) "NONE", ( _bstr_t ) "" );
        Serializer->StartElement ( "TestInfo", m_Web_NameSpace.GetString(), "NONE", "" );
        for ( int i = 0 ; i < 6 ; i++ )
        {
            Serializer->StartElement ( "string", m_Web_NameSpace.GetString(), "NONE", "" );
            Serializer-> WriteString ( SysAllocString ( TestInfo[i] ) );
            Serializer->EndElement();
        }
        Serializer->EndElement();///TestInfo
        Serializer-> EndElement(); //UpdateProduceLotTest

Serializer-> EndBody();
        Serializer->EndEnvelope();

//消息真正地发给Web服务
        hr = SoapConnector->EndMessage();
        if ( FAILED ( hr ) )
            return   L" ";
        //   读取响应
        Reader.CreateInstance ( __uuidof ( SoapReader30 ) );
        //   将reader联接到connector的输出字符串
        Reader->Load ( _variant_t ( ( IUnknown* ) SoapConnector->OutputStream ), _T ( "" ) );
        CString str = Reader->RpcResult->Gettext();
        return   str;
    }
    catch ( _com_error e )
    {
        CString msg = TEXT ( "WebService调用出错,请检查URL与名字空间是否正确,错误描述:" );
        msg += e.ErrorMessage();
        return  msg;
    }
}

void CallWebSerVice::SetUrlInfor ( CString strUrl, CString strNamespace )
{
    m_Web_Uri = strUrl;
    m_Web_NameSpace = strNamespace;
    m_Web_Action.Format ( TEXT ( "%s%s" ), strNamespace, CALL_WEB_SER_FUNCTION_NAME );
}

SAOP使用的一个例子相关推荐

  1. [asp.net core]SignalR一个例子

    摘要 在一个后台管理的页面想实时监控一些操作的数据,想到用signalR. 一个例子 asp.net core+signalR 使用Nuget安装包:Microsoft.AspNetCore.Sign ...

  2. R语言使用lm构建线性回归模型、并将目标变量对数化(log10)实战:可视化模型预测输出与实际值对比图、可视化模型的残差、模型预测中系统误差的一个例子 、自定义函数计算R方指标和均方根误差RMSE

    R语言使用lm构建线性回归模型.并将目标变量对数化(log10)实战:可视化模型预测输出与实际值对比图.可视化模型的残差.模型预测中系统误差的一个例子 .自定义函数计算R方指标和均方根误差RMSE 目 ...

  3. python中self_一个例子带你入门Python装饰器

    ============ 欢迎关注我的公众号:早起python ============ 前言 在还未正式发布的python3.9中,有一个新功能值得关注,那就是任意表达式可以作为装饰器,如果你还不知 ...

  4. ftp服务器文件备份,数据备份是十分重要的,下面是通过ftp将本机数据备份到远程服务器的一个例子...

    数据备份是十分重要的,下面是通过ftp将本机数据备份到远程服务器的一个例子 以备份oracle数据为例 本机IP:192.168.0.1 远程IP:192.168.0.111 备份脚本 ora_bak ...

  5. Bootice1.34版本把grub4dos0.46a写入硬盘MBR失败一个例子

    Bootice1.34版本把grub4dos0.46a写入硬盘MBR失败一个例子         一个同事的台式机,BIOS启动,500GB硬盘,分了四个MBR分区,C盘是激活的主分区,第二个分区50 ...

  6. 用一个例子告诉你gdb调试工具如何使用

                                        用GDB调试程序 GDB概述 GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式 ...

  7. C++中const——由一个例子想到的

    前天同学实现了<C++ Primer>中关于虚函数的一个例子,拿过来问我,代码如下: #include<iostream> #include<string> usi ...

  8. UA PHYS515A 电磁理论II 静电学问题的一个例子

    UA PHYS515A 电磁理论II 静电学问题的一个例子 例 假设有一个中空球形导体,中空部分也是一个球形,半径为aaa,球心与导体相同,导体半径为bbb:球心处有一个+q+q+q的点电荷,距离圆心 ...

  9. UA MATH566 一个例子:什么是隐状态

    UA MATH566 一个例子:什么是隐状态 对试验结果的分析 对隐状态的分析 假设一个包里有三个色子,分别是色子A.色子B和色子C,每个色子的六个面上都标有1-4中的某个数字,其中色子A有两面标1. ...

最新文章

  1. Quartus下载 安装 与 和谐教程
  2. python中chr函数的用法_python中hex,oct,chr,ord函数讲解
  3. html图片怎么设置悬浮效果,图片漂浮效果js实现
  4. Postman批量接口测试
  5. LiveVideoStack线上交流分享 ( 五 ) —— 在线教育音视频技术探索与应用
  6. Linux下切换用户出现su: Authentication failure的解决办法
  7. 类数组arguments
  8. 给SAP Spartacus B2B list增加用户提示信息
  9. Android项目实战(二十二):启动另一个APP or 重启本APP
  10. 苏宁双11战报:0点~1点 线上订单同比增72%
  11. 改变swap分区大小
  12. 神思第二代身份证验证系统
  13. 好好学习努力工作,要工作也要生活—2016总结,2017规划
  14. 《穿越计算机的迷雾》读书笔记一
  15. Macbook 黑白打印pdf设置
  16. Python遍历文件夹下所有文件及目录
  17. [管理]鼎捷软件售后服务体验
  18. 如何防止游戏通讯数据被篡改
  19. 迪文屏学习系列之数据录入
  20. 解决外接显示屏后CPU占用率过高问题

热门文章

  1. 艾永亮:市场需求回暖,多家企业进行创新,超级产品推动企业发展
  2. ROS-Industrial 之 simple_message Overview
  3. tkinter模块高级操作(一)—— 透明按钮、透明文本框、自定义按钮及自定义文本框
  4. three.js汇总,老牌Web 3d展示Js
  5. 当今互联网企业用哪些技术_当今25家最成功的WordPress企业和公司
  6. 亚马逊采摘挑战赛APC:6D姿态估计的多视图自我监督深度学习6D Pose Estimation in the Amazon Picking Challenge—2017(笔记)
  7. 如何运用数据分析,更好地为网络营销服务?
  8. 你妹都看得懂的手机网游制作教程(第21篇)游戏黑屏了,别急我们来调试代码
  9. Unity VR——全景视频播放方案
  10. android预置app可卸载实现,Android系统预制可自由卸载apk