加急: 请思归老大和众高手指导关于WEB SERVICE接口定义的问题-小妹先谢过了

linger_liang 2004-09-15 11:05:54
有一个问题要请教大家一下,是这样的我们要做一个web service,功能就是接收一个xml包,解析它得到它包含的数据写入我们自己的数据库,然后再回复一个xml包给对方
下面是两个xml包的格式,能否指导我订一个web service的接口,我对.net实在是不熟,请帮帮忙,因为时间紧,所以只好向大家请教了!谢谢!还请其他各位高手抽时间指导我一下,万分感谢!!

//post包----------SyncOrderRelationReq----------------

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<TransactionID xmlns="http://10.1.2.122/misc/dsmp.xsd">00110100037392</TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SyncOrderRelationReq xmlns="http://10.1.2.122/misc/dsmp.xsd">
<Version>1.5.0</Version>
<MsgType>SyncOrderRelationReq</MsgType>
<Send_Address>
<DeviceType>0</DeviceType>
<DeviceID>0011</DeviceID>
</Send_Address>
<Dest_Address>
<DeviceType>400</DeviceType>
<DeviceID>0</DeviceID>
</Dest_Address>
<FeeUser_ID>
<UserIDType>2</UserIDType>
<MSISDN></MSISDN>
<PseudoCode>00116000000286</PseudoCode>
</FeeUser_ID>
<DestUser_ID>
<UserIDType>2</UserIDType>
<MSISDN></MSISDN>
<PseudoCode>00116000000286</PseudoCode>
</DestUser_ID>
<LinkID>SP</LinkID>
<ActionID>1</ActionID>
<ActionReasonID>1</ActionReasonID>
<SPID>9999999</SPID>
<SPServiceID>0000000064</SPServiceID>
<AccessMode>2</AccessMode>
<FeatureStr></FeatureStr>
</SyncOrderRelationReq>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



SyncOrderRelationReq消息字段描述:

名称 类型
MsgType string
TransactionID string
Version string
Send_Address address_info_schema
Dest_Address address_info_schema
FeeUser_ID user_id_schema
DestUser_ID user_id_schema
LinkID string
ActionID integer
ActionReasonID integer
SPID string
SPServiceID string
AccessMode Integer
FeatureStr binary

//====
Schema字段描述
1、address_info_schema
字段名称 字段类型
DeviceType integer
DeviceID string

2、user_id_schema
字段名称 字段类型
UserIDType integer
MSISDN string
PseudoCode binary

//==========


//===回复包--SyncOrderRelationResp----------------------
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x
sd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org
/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<TransactionID xmlns="http://www.monternet.com/dsmp/schemas/">
00110100037392</TransactionID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SyncOrderRelationResp xmlns="http://www.monternet.com/dsmp/schemas/">
<Version>1.5.0</Version>
<MsgType>SyncOrderRelationResp</MsgType>
<hRet>0</hRet>
</SyncOrderRelationResp>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SyncOrderRelationResp消息字段描述:
字段名 类型
MsgType string
TransactionID string
Version string
hRet integer

...全文
286 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
linger_liang 2004-09-23
  • 打赏
  • 举报
回复
matq2008(叶子.net) :你好,谢谢你的帮助,现在还有几个问题要请教一下,现在我正向的接口已经基本做好了。开始做反向的,我查找了我手里的资料,没有找到两个反向接口的wsdl文件,你哪里有么?因为我对xml实在是不熟悉,所以如果有反向接口的wsdl文件我就可以生成代理类,然后就可以像使用函数那样使用了,不用去解析xml了。如果你那里有可否给我email一份过来,我邮箱和msn都是linger_liang@hotmail.com,谢谢了!
ddggggdd 2004-09-23
  • 打赏
  • 举报
回复
up
whwjn 2004-09-22
  • 打赏
  • 举报
回复
u[
qiri07 2004-09-21
  • 打赏
  • 举报
回复
呵呵,都是从misc论坛过来的哦
qiri07 2004-09-20
  • 打赏
  • 举报
回复
C#的搞定,vb.net 没有
叶子哟 2004-09-20
  • 打赏
  • 举报
回复
这是完整的数据包格式:
http://www.sp-forum.org/bbs/UploadFile/2004-7/20047160389909.txt
叶子哟 2004-09-20
  • 打赏
  • 举报
回复
关键在于
<dsmp:SyncOrderRelationReq xmlns:dsmp="...http://www.monternet.com/dsmp/schemas/">...</dsmp:SyncOrderRelationReq>

<SyncOrderRelationReq xmlns="...http://www.monternet.com/dsmp/schemas/">...</SyncOrderRelationReq>
的含义是不一样的。如果想让程序兼容dsmpclient,可以象如下这样改程序,但能不能兼容移动实际的系统就难说喽:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Web.Services.Description;

namespace Provision
{


/// <summary>
/// Summary description for Service1.
/// </summary>
[WebService(Namespace="http://www.monternet.com/dsmp/schemas/")]
public class Provision : System.Web.Services.WebService
{
public Provision()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();

}

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

// WEB SERVICE EXAMPLE
// The HelloWorld() example service returns the string Hello World
// To build, uncomment the following lines then save and build the project
// To test this web service, press F5


public TransactionID transID;

[WebMethod]
[SoapHeader("transID", Direction=SoapHeaderDirection.InOut)]
[SoapDocumentMethod("sim.SyncOrderRelation",RequestElementName="SyncOrderRelationReq",ResponseElementName="SyncOrderRelationResp",Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.SoapElementAttribute("return")]
public void SyncOrderRelation(
[XmlElement(Form=XmlSchemaForm.Unqualified)]
ref string Version ,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
ref string MsgType,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
AddressInfo Send_Address,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
AddressInfo Dest_Address,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
UserID FeeUser_ID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
UserID DestUser_ID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
string LinkID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
int ActionID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
int ActionReasonID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
string SPID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
string SPServiceID,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
int AccessMode,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
byte[] FeatureStr,
[XmlElement(Form=XmlSchemaForm.Unqualified)]
out int hRet
)
{
Version="1.5.0";
MsgType = "SyncOrderRelationResp";
hRet = 0;
}
}

[XmlRoot(Namespace="http://www.monternet.com/dsmp/schemas/")]
public class TransactionID: SoapHeader
{
[XmlText(typeof(string))]
public string ID;

}

public class UserID
{
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public int UserIDType;
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string MSISDN;
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string PseudoCode;
}

//[XmlRoot(Namespace="http://aaa.com/")]
public class AddressInfo
{
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public int DeviceType;
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string DeviceID;
}


}
叶子哟 2004-09-20
  • 打赏
  • 举报
回复
楼上的,C#贡献一下,如何呀?以下为我看到的有人实现的,但未经使用过:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Serialization;
using System.Web.Services.Description;

namespace Provision
{

[XmlRoot(Namespace="http://www.monternet.com/dsmp/schemas/")]
public class TransactionID: SoapHeader
{
[XmlText(typeof(string))]
public string ID;
}

public class UserID
{
public int UserIDType;
public string MSISDN;
public string PseudoCode;
}

[XmlRoot(Namespace="http://aaa.com/")]
public class AddressInfo
{
public int DeviceType;
public string DeviceID;
}

public class SyncOrderRelationResp
{
public string Version;
public string MsgType;
public int hRet;
}


/// <summary>
/// Summary description for Service1.
/// </summary>
[WebService(Namespace="http://12345.com.cn")]
[SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)]
public class Provision : System.Web.Services.WebService
{
public Provision()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

// WEB SERVICE EXAMPLE
// The HelloWorld() example service returns the string Hello World
// To build, uncomment the following lines then save and build the project
// To test this web service, press F5

public TransactionID transID;

[WebMethod]
[SoapHeader("transID", Direction=SoapHeaderDirection.InOut)]
[SoapDocumentMethod("",RequestElementName="SyncOrderRelationReq",ResponseElementName="SyncOrderRelationResp")]
[return: System.Xml.Serialization.SoapElementAttribute("return")]
public void SyncOrderRelationReq(
ref string Version ,
ref string MsgType,
AddressInfo Send_Address,
AddressInfo Dest_Address,
UserID FeeUser_ID,
UserID DestUser_ID,
string LinkID,
int ActionID,
int ActionReasonID,
string SPID,
string SPServiceID,
int AccessMOde,
byte[] FeatureStr,
out int hRet
)
{
Version="1.5.0";
MsgType = "SyncOrderRelationResp";
hRet = 0;
}
}
}
rottenapple 2004-09-16
  • 打赏
  • 举报
回复
我以前遇到过,我使用WSE解决。你这个也不复杂,自己构造xml串就可以,注意header要加入
linger_liang 2004-09-15
  • 打赏
  • 举报
回复
net_lover(孟子E章):那我怎么定义WEB SERVICE的相关属性才能跟我的那两段XML报文正确接口呢?
孟子E章 2004-09-15
  • 打赏
  • 举报
回复
其实看看.net sdk,或者到网上搜擞,基本就 可以找到解决办法了

http://dotnet.aspx.cc/ShowList.aspx?id=6
孟子E章 2004-09-15
  • 打赏
  • 举报
回复
xml写数据库

http://dotnet.aspx.cc/ShowDetail.aspx?id=6ADD72FB-3C6D-47AD-7D68-21EB9E395275

linger_liang 2004-09-15
  • 打赏
  • 举报
回复
to:cnroky(残月) 大家一起讨论,我现在在很多高手好心人的帮助下,已经有点眉目了,你可以联系我,linger_liang@hotmail.com我的msn
myclife 2004-09-15
  • 打赏
  • 举报
回复
用.net实现MISC的订购SP服务程序要省很多事,可惜我对Web Service也不了解,你们帮帮她吧:)
cnroky 2004-09-15
  • 打赏
  • 举报
回复
MISC系统,偶目前也在急呀,对websevice的了解很少。关注中!
yichuan1982 2004-09-15
  • 打赏
  • 举报
回复
我头都晕了,喳喳

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧