D7调VS2005的web service函数接口时提示”无法识别请求元素“错误

wyj1974 2010-09-17 09:34:03
接口是http://service.tel99.cn/YtFaxWebService.asmx?WSDL
请大家给个建议,谢谢
...全文
285 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
ppluming 2010-10-13
  • 打赏
  • 举报
回复
我真服了楼主了,
1.楼主调用该服务,没有该服务的输入参数说明,没有返回参数说明,你当然不知道如何使用该服务了。建议你去询问一下该服务的函数说明。
2. 在只能猜测该服务的参数作用的情况下,参数 _xml 貌似需要输入是一个XML文件全文本,于是我就使用了一段XML空白全文本
<?xml version="1.0" encoding="GB2312"?><Data></Data>
进行测试,结果服务出现错误,说明在服务端没有很好的处理XML,或者说我们猜测的这个参数 _xml 不是这么使用的。
wyj1974 2010-10-13
  • 打赏
  • 举报
回复
[Quote=引用 22 楼 copy_paste 的回复:]

你试试将THTTPRIO中的字符集弄成utf8试试,看看是不是这原因
[/Quote]

试过也不是这个问题
copy_paste 2010-10-06
  • 打赏
  • 举报
回复
你试试将THTTPRIO中的字符集弄成utf8试试,看看是不是这原因
wyj1974 2010-10-06
  • 打赏
  • 举报
回复
就是调用接口的时候报错~
likeyrain 2010-10-06
  • 打赏
  • 举报
回复
能不能跟踪看是那一句出错了
kye_jufei 2010-09-28
  • 打赏
  • 举报
回复
認真檢查一下XML編碼格式(估計是某個節點出錯),一般在調試時會有返回值的。。。
另外,如果傳參數時用的是中文,請記得使用unicode方式。。。
wyj1974 2010-09-26
  • 打赏
  • 举报
回复
[Quote=引用 17 楼 likeyrain 的回复:]

可能是XML的节点出错了
[/Quote]
应该不是XML格式的问题,我这边怎么设置都是这个错误
likeyrain 2010-09-25
  • 打赏
  • 举报
回复
可能是XML的节点出错了
wyj1974 2010-09-21
  • 打赏
  • 举报
回复
VS2005写的接口函数头文件:
[SoapDocumentMethod(Action = "http://soap.model.service.YuanTel.com/FaxDoAction",
RequestNamespace = "http://soap.model.service.YuanTel.com",
RequestElementName = "YtDoActionWrapper",//YtDoActionWrapper 特别定义的 如果对接时 对方会得到此方法名 要求对方写固定
ResponseNamespace = "http://soap.model.service.YuanTel.com",
ResponseElementName = "YtDoActionResultWrapper",
Use = SoapBindingUse.Literal,
ParameterStyle = SoapParameterStyle.Wrapped)] //参数风格为:Encoded 并且是Bare
[WebMethod(Description = "YtDoAction")]

public string YtDoAction(string _xml)
{

//1 保存 _xml 时间
xmlAdd = new XML_Add();
string hostIP = Global.GetHostIP();
//WriteLog(DateTime.Now.ToString() + _xml + hostIP + "\n");
int state = xmlAdd.AddJoinAllXML("1", hostIP, DateTime.Now.ToString(), _xml);
//如果插入数据不成功并且没有异常的情况
wyj1974 2010-09-19
  • 打赏
  • 举报
回复
问题依旧没解决
haitao 2010-09-17
  • 打赏
  • 举报
回复
xml,不同开发语言生成、要求的细微格式差异会害死人
kye_jufei 2010-09-17
  • 打赏
  • 举报
回复
你檢查一下你的Service。。。
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,YtFaxWebService, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
aa:YtFaxWebServiceSoap;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
aa:=GetYtFaxWebServiceSoap(False,'',nil);
ShowMessage(aa.YtDoAction(Edit1.Text));
end;

end.
kye_jufei 2010-09-17
  • 打赏
  • 举报
回复
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://service.tel99.cn/YtFaxWebService.asmx?WSDL
// Encoding : utf-8
// Version : 1.0
// (2010/9/17 上午 11:38:10 - 1.33.2.5)
// ************************************************************************ //

unit YtFaxWebService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"



// ************************************************************************ //
// Namespace : http://soap.model.service.YuanTel.com
// soapAction: http://soap.model.service.YuanTel.com/FaxDoAction
// transport : http://schemas.xmlsoap.org/soap/http
// binding : YtFaxWebServiceSoap
// service : YtFaxWebService
// port : YtFaxWebServiceSoap
// URL : http://service.tel99.cn/YtFaxWebService.asmx
// ************************************************************************ //
YtFaxWebServiceSoap = interface(IInvokable)
['{67D18A09-D65C-6CDE-BBD4-DF9A35E18511}']
function YtDoAction(const _xml: WideString): WideString; stdcall;
end;

function GetYtFaxWebServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): YtFaxWebServiceSoap;


implementation

function GetYtFaxWebServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): YtFaxWebServiceSoap;
const
defWSDL = 'http://service.tel99.cn/YtFaxWebService.asmx?WSDL';
defURL = 'http://service.tel99.cn/YtFaxWebService.asmx';
defSvc = 'YtFaxWebService';
defPrt = 'YtFaxWebServiceSoap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as YtFaxWebServiceSoap);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;


initialization
InvRegistry.RegisterInterface(TypeInfo(YtFaxWebServiceSoap), 'http://soap.model.service.YuanTel.com', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(YtFaxWebServiceSoap), 'http://soap.model.service.YuanTel.com/FaxDoAction');

end.
kye_jufei 2010-09-17
  • 打赏
  • 举报
回复
http://service.tel99.cn/YtFaxWebService.asmx?op=YtDoAction中的_xml到底返回什麼???
來回都是以下...

  <?xml version="1.0" encoding="utf-8" ?> 
<string xmlns="http://soap.model.service.YuanTel.com" />
wyj1974 2010-09-17
  • 打赏
  • 举报
回复
我的是WinXP系统,D7
bdmh 2010-09-17
  • 打赏
  • 举报
回复
你调用的是那些方法,你用的是什么系统
iqyely 2010-09-17
  • 打赏
  • 举报
回复
来关注下
L3nnon 2010-09-17
  • 打赏
  • 举报
回复
学习。。 学习。。
wyj1974 2010-09-17
  • 打赏
  • 举报
回复
传递的XML参数可以是:
<DataInfo><ActionUserInfo> <ActionCode>Login</ActionCode> <SessionID>201009150001</SessionID> <AppKey>54432966</AppKey> <LoginCode>7</LoginCode> <Param1 /> <Param2>sitsoft@163.com</Param2> <Param3>a12345678</Param3> </ActionUserInfo> </DataInfo>
wyj1974 2010-09-17
  • 打赏
  • 举报
回复
需要传递一个XML格式的字符串参数,返回的也是XML格式字符串
我现在的问题是怎么搞都不行
[Quote=引用 8 楼 kye_jufei 的回复:]

http://service.tel99.cn/YtFaxWebService.asmx?op=YtDoAction

以下_xml是一個const(widestring),它到底返回什麼?空值或有值都會出現???

HTML code
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://soap.model……
[/Quote]
加载更多回复(4)

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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