asp 调java webservice问题

fujunle 2014-02-08 04:14:52
Set xmldoc = server.createObject("Msxml2.DOMDocument")
xmldoc.async = false

Set soapclient = server.CreateObject("MSSOAP.SoapClient30")
soapclient.ClientProperty("ServerHTTPRequest") = True
soapclient.mssoapinit "http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl","http://schemas.xmlsoap.org/soap/http","",""
str = soapclient.retireTicket(retireTicket)
response.Write str


提示错误:
Client 错误 '80020009'

Client:The requested service http://schemas.xmlsoap.org/soap/http could not be found in the 'default' namespace of the WSDL file HRESULT=0x80070057: 参数不正确。 - Client:One of the parameters supplied is invalid. HRESULT=0x80070057: 参数不正确。
...全文
220 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 12 楼 fujunle 的回复:
你好版主, 还有这个webservice中应该有个接收数据的retireTicket方法 我怎样来写传参数的部分
这个需要拼装WebService头部 url="http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl"'接受方法的地址 SoapRequest=""'拼装WebService头部 Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP") xmlhttp.Open "POST",url,false xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8" xmlhttp.setRequestHeader "HOST","220.250.64.122" xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest) xmlhttp.setRequestHeader "SOAPAction", "WebService地址" xmlhttp.Send(SoapRequest) 'Response.Write xmlhttp.Status&" " 'Response.Write xmlhttp.StatusText If xmlhttp.Status = 200 Then Set xmlDOC = server.CreateObject("MSXML.DOMDocument") xmlDOC.load(xmlhttp.responseXML) sendMessageByPhone=xmlDOC.documentElement.selectNodes("//sendMessageResult")(0).text Set xmlDOC = nothing Else 'Response.Write xmlhttp.Status&" " sendMessageByPhone=xmlhttp.StatusText End if Set xmlhttp = Nothing
fujunle 2014-02-10
  • 打赏
  • 举报
回复
引用 4 楼 fujunle 的回复:
java的webservice不会写拼头,试了好多次都不行
可能我之前没说清楚,前面我说的拼头就是指“拼装WebService头部” 下面是我拼过的,第一个拼接有问题,第二个WEBSERVICE的命名空间应该也有问题
Url="http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl"
SoapRequest1="<soapenv:Envelope "& _
"xmlns:soapenv="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&CHR(34)&" "& _
"xmlns:soapenv="&CHR(34)&"http://www.w3.org/2001/XMLSchema"&CHR(34)&" "& _
"xmlns:XI="&CHR(34)&"http://www.w3.org/2001/XMLSchema-instance"&CHR(34)&" "& _
"xmlns:a="&CHR(34)&"urn:veSWScnService"&CHR(34)&">"& _
"<S:Body>"& _
"<a:retireTicket XI:type="&CHR(34)&"XS:string"&CHR(34)&">str</a:retireTicket>"& _
"</S:Body>"& _
"</S:Envelope>"

SoapRequest1="<soapenv:Envelope xmlns:soapenv="&CHR(34)&"http://schemas.xmlsoap.org/soap/envelope/"&CHR(34)&">"& _
"<soapenv:Header xmlns:wsa="&CHR(34)&"http://www.w3.org/2005/08/addressing"&CHR(34)&">"& _
"<wsa:Action>"&CHR(34)&"http://www.w3.org/2005/08/addressing/soap/fault"&CHR(34)&"</wsa:Action></soapenv:Header>"& _
"<soapenv:Body>"& _
"<a:retireTicket xmlns:type="&CHR(34)&"XS:string"&CHR(34)&">str</a:retireTicket>"& _
"</soapenv:Body>"& _
"</soapenv:Envelope>"

Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "POST",url,false
xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
xmlhttp.setRequestHeader "HOST","localhost"
xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest1)
xmlhttp.setRequestHeader "SOAPAction", "http://schemas.xmlsoap.org/soap/http/retireTicket" '一定要与WEBSERVICE的命名空间相同,否则服务会拒绝
xmlhttp.Send(SoapRequest1)
response.Write(xmlhttp.status)
response.Write("<br>"&xmlhttp.responseText)
response.End()
fujunle 2014-02-08
  • 打赏
  • 举报
回复
你好版主, 还有这个webservice中应该有个接收数据的retireTicket方法 我怎样来写传参数的部分
fujunle 2014-02-08
  • 打赏
  • 举报
回复
引用 9 楼 hongmeiluoye 的回复:
在vs命令行中运行就可以生成动态库,asp.net直接用这个动态库就行了 A》生成类文件 wsdl.exe /l:cs /n:NWS /out:C:/NWS.cs http://***.***.**.**/WebSite1/Service?wsdl B》将类文件编译成动态库 csc /target:library /out:"c:\NWS.dll" c:\NWS.cs
我用的是asp不是asp.net
fujunle 2014-02-08
  • 打赏
  • 举报
回复
为什么返回的信息和http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl和这个地址XML一样样的,正确返回值应该是: 参数名称 数据类型 中文说明 resultCode String 操作结果标识(0:操作成功;1:操作失败) resultMessage String 操作结果编码(参见2.1.2操作结果编码) <UseResponse> <resultCode>操作结果标识</resultCode> <resultMessage>操作结果编码</resultMessage> </UseResponse>
莫待 2014-02-08
  • 打赏
  • 举报
回复
在vs命令行中运行就可以生成动态库,asp.net直接用这个动态库就行了 A》生成类文件 wsdl.exe /l:cs /n:NWS /out:C:/NWS.cs http://***.***.**.**/WebSite1/Service?wsdl B》将类文件编译成动态库 csc /target:library /out:"c:\NWS.dll" c:\NWS.cs
fujunle 2014-02-08
  • 打赏
  • 举报
回复
为什么返回的信息和http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl
  • 打赏
  • 举报
回复
url = "http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl" 
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP") 
xmlhttp.Open "GET",url,false 
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"'注意 
xmlhttp.setRequestHeader "HOST","220.250.64.122" 
xmlhttp.setRequestHeader "Content-Length",LEN(url) 
xmlhttp.Send(url) 
'这样就利用XMLHTTP成功发送了与HTTP POST示例所符的POST请求. 
'检测一下是否成功: 
If xmlhttp.Status = 200 Then '调用成功
   Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
   xmlDOC.load(xmlhttp.responseXML)'使用xml文档的格式
  response.Write xmlDOC.childNodes(1).Text 
   Set xmlDOC=nothing
Else
Response.Write xmlhttp.Status&" "
Response.Write xmlhttp.StatusText
End if
可以转成xml的读取各节点
  • 打赏
  • 举报
回复
引用 4 楼 fujunle 的回复:
java的webservice不会写拼头,试了好多次都不行
这个你都可以调用net的,java根本没啥区别
  • 打赏
  • 举报
回复
url = "http://220.250.64.122/UIP/services/MgPUBTicketRetireService?wsdl" 
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP") 
xmlhttp.Open "GET",url,false 
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"'注意 
xmlhttp.setRequestHeader "HOST","220.250.64.122" 
xmlhttp.setRequestHeader "Content-Length",LEN(url) 
xmlhttp.Send(url) 
'这样就利用XMLHTTP成功发送了与HTTP POST示例所符的POST请求. 
'检测一下是否成功: 
Response.Write bytesToBSTR(xmlhttp.responseBody,"GB2312") 
Set xmlhttp = Nothing  

Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText 
objstream.Close
set objstream = nothing
End Function
fujunle 2014-02-08
  • 打赏
  • 举报
回复
java的webservice不会写拼头,试了好多次都不行
fujunle 2014-02-08
  • 打赏
  • 举报
回复
不用写这个拼头,试了好多次都行,像.net Webservice我可以调出来。 还请大侠就当前这个地址,给个小实例
  • 打赏
  • 举报
回复
你前面都用了 Set xmldoc = server.createObject("Msxml2.DOMDocument") xmldoc.async = false 为什么不直接就用他,后面反而用了MSSOAP.SoapClient30
fujunle 2014-02-08
  • 打赏
  • 举报
回复
自己顶一个,请大家关注一下

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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