asp 提交xml问题

spirit888 2014-01-24 04:47:22
SoapRequest="<?xml version=""1.0"" encoding=""utf-8""?>"
SoapRequest=SoapRequest&"<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"">"
SoapRequest=SoapRequest&"<soap12:Body>"
SoapRequest=SoapRequest&"<YH_Login xmlns=""http://www.jdd365.com/"">"
SoapRequest=SoapRequest&"<sToken>string</sToken>"
SoapRequest=SoapRequest&"<sTokenKey>string</sTokenKey>"
SoapRequest=SoapRequest&"<sUser>string</sUser>"
SoapRequest=SoapRequest&"<sPsw>string</sPsw>"
SoapRequest=SoapRequest&"</YH_Login>"
SoapRequest=SoapRequest&"</soap12:Body>"
SoapRequest=SoapRequest&"</soap12:Envelope>"
'response.Write(SoapRequest)
url = "http://www.jdd365.com/webservice/jd.asmx?WSDL" '原地址
Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.Open "get",url,false
xmlhttp.Send("1.xml")

If xmlhttp.Status = 200 Then
Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
If xmlDOC.ReadyState>2 Then
Response.Write("文档已经就绪。状态:"& xmlDOC.ReadyState&"<br>" )
xmlDOC.load(xmlhttp.responseXML)
response.write xmlDOC.childNodes(0).text&"<br>"
response.write xmlDOC.getElementsByTagName("Result").item(0).text&"<br>"
'response.write xmlDOC.getElementsByTagName("Msg").item(0).text&"<br>"
Else
Response.Write("文档还未就绪。状态:"& xmlDOC.ReadyState )
end if
Set xmlDOC = nothing
Else
Response.Write xmlhttp.Status&"<br>"
Response.Write xmlhttp.StatusText
End if
Set xmlhttp = Nothing

代码如上,服务器应该返回
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><YH_LoginResponse xmlns="http://www.jdd365.com/"><YH_LoginResult><Result>0</Result><Msg>验证Key不正确</Msg></YH_LoginResult></YH_LoginResponse></soap:Body></soap:Envelope>

但是取Msg死都取不到,我已经崩溃了,求各位大神指教。通过调试软件测试,服务器能正确返回值
把提交的XML再单独发一下
<?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><YH_Login xmlns="http://www.jdd365.com/"><sToken>string</sToken><sTokenKey>string</sTokenKey><sUser>string</sUser><sPsw>string</sPsw></YH_Login></soap12:Body></soap12:Envelope>
...全文
305 点赞 收藏 6
写回复
6 条回复
spirit888 2014年02月15日
成功了,万分感谢,请问是怎么生成的或者有相关的学习资料能发一下吗?分全给你了
回复 点赞
spirit888 2014年02月13日
非常感谢,我试一下
回复 点赞
YYYYYYYYY-X 2014年01月26日
再一个版本。

<%
'Class: MoWS_JD
'ServicesName: JD
'Url: http://www.jdd365.com/webservice/jd.asmx
'Created By: MoWs

Class MoWS_JD
	Public Url,Charset,targetNamespace,retXml,retBody,Method
	Private Sub Class_Initialize()
		Url = "http://www.jdd365.com/webservice/jd.asmx"
		targetNamespace = "http://www.jdd365.com/"
		Method = "Soap"
		Charset="UTF-8"
	End Sub
	
	'In: sToken:string,sTokenKey:string,sSoftVer:string
	'Return:string
	Public Function GetAppVersion(sToken,sTokenKey,sSoftVer)
		retXml = doWebservicesSoap("GetAppVersion","sToken,sTokenKey,sSoftVer",Array(sToken,sTokenKey,sSoftVer),"http://www.jdd365.com/GetAppVersion","GetAppVersion")
		GetAppVersion = getResult(retXml,"GetAppVersionResponse/GetAppVersionResult","string")
	End Function

	'In: sToken:string,sTokenKey:string,sSoftVer:string
	'Return:MyResult
	Public Function GetAppVersion_Android(sToken,sTokenKey,sSoftVer)
		retXml = doWebservicesSoap("GetAppVersion_Android","sToken,sTokenKey,sSoftVer",Array(sToken,sTokenKey,sSoftVer),"http://www.jdd365.com/GetAppVersion_Android","GetAppVersion_Android")
		GetAppVersion_Android = getResult(retXml,"GetAppVersion_AndroidResponse/GetAppVersion_AndroidResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sCity:string,sDay1:string,sDay2:string,sKey:string,iPrice:int,iOrder:int,iPage:int
	'Return:JDListResult
	Public Function SearchJD(sToken,sTokenKey,sCity,sDay1,sDay2,sKey,iPrice,iOrder,iPage)
		retXml = doWebservicesSoap("SearchJD","sToken,sTokenKey,sCity,sDay1,sDay2,sKey,iPrice,iOrder,iPage",Array(sToken,sTokenKey,sCity,sDay1,sDay2,sKey,iPrice,iOrder,iPage),"http://www.jdd365.com/SearchJD","SearchJD")
		SearchJD = getResult(retXml,"SearchJDResponse/SearchJDResult","JDListResult")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string,sDay1:string,sDay2:string
	'Return:JDXX
	Public Function GetJDXX(sToken,sTokenKey,sJDID,sDay1,sDay2)
		retXml = doWebservicesSoap("GetJDXX","sToken,sTokenKey,sJDID,sDay1,sDay2",Array(sToken,sTokenKey,sJDID,sDay1,sDay2),"http://www.jdd365.com/GetJDXX","GetJDXX")
		GetJDXX = getResult(retXml,"GetJDXXResponse/GetJDXXResult","JDXX")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string,sFXID:string,sDay1:string,sDay2:string
	'Return:JD_FJLXEX
	Public Function GetJD_FJLX(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2)
		retXml = doWebservicesSoap("GetJD_FJLX","sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2",Array(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2),"http://www.jdd365.com/GetJD_FJLX","GetJD_FJLX")
		GetJD_FJLX = getResult(retXml,"GetJD_FJLXResponse/GetJD_FJLXResult","JD_FJLXEX")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string,sFXID:string,sDay1:string,sDay2:string,sFS:string,sPrice:string,sRZR:string,sLXR:string,sMobile:string,sBZ:string,lsTime:string,isBill:string,sTimeTick:string
	'Return:OrdersResult
	Public Function JD_Orders(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2,sFS,sPrice,sRZR,sLXR,sMobile,sBZ,lsTime,isBill,sTimeTick)
		retXml = doWebservicesSoap("JD_Orders","sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2,sFS,sPrice,sRZR,sLXR,sMobile,sBZ,lsTime,isBill,sTimeTick",Array(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2,sFS,sPrice,sRZR,sLXR,sMobile,sBZ,lsTime,isBill,sTimeTick),"http://www.jdd365.com/JD_Orders","JD_Orders")
		JD_Orders = getResult(retXml,"JD_OrdersResponse/JD_OrdersResult","OrdersResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUser:string,sPsw:string
	'Return:MyResult
	Public Function YH_Login(sToken,sTokenKey,sUser,sPsw)
		retXml = doWebservicesSoap("YH_Login","sToken,sTokenKey,sUser,sPsw",Array(sToken,sTokenKey,sUser,sPsw),"http://www.jdd365.com/YH_Login","YH_Login")
		YH_Login = getResult(retXml,"YH_LoginResponse/YH_LoginResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sMobile:string,sUser:string,sPsw:string
	'Return:MyResult
	Public Function YH_Reg(sToken,sTokenKey,sMobile,sUser,sPsw)
		retXml = doWebservicesSoap("YH_Reg","sToken,sTokenKey,sMobile,sUser,sPsw",Array(sToken,sTokenKey,sMobile,sUser,sPsw),"http://www.jdd365.com/YH_Reg","YH_Reg")
		YH_Reg = getResult(retXml,"YH_RegResponse/YH_RegResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string,sJDID:string
	'Return:MyResult
	Public Function YH_Fav(sToken,sTokenKey,sUserID,sJDID)
		retXml = doWebservicesSoap("YH_Fav","sToken,sTokenKey,sUserID,sJDID",Array(sToken,sTokenKey,sUserID,sJDID),"http://www.jdd365.com/YH_Fav","YH_Fav")
		YH_Fav = getResult(retXml,"YH_FavResponse/YH_FavResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string,sJDID:string
	'Return:MyResult
	Public Function YH_FavDel(sToken,sTokenKey,sUserID,sJDID)
		retXml = doWebservicesSoap("YH_FavDel","sToken,sTokenKey,sUserID,sJDID",Array(sToken,sTokenKey,sUserID,sJDID),"http://www.jdd365.com/YH_FavDel","YH_FavDel")
		YH_FavDel = getResult(retXml,"YH_FavDelResponse/YH_FavDelResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string
	'Return:ArrayOfJDList
	Public Function GetYH_FavList(sToken,sTokenKey,sUserID)
		retXml = doWebservicesSoap("GetYH_FavList","sToken,sTokenKey,sUserID",Array(sToken,sTokenKey,sUserID),"http://www.jdd365.com/GetYH_FavList","GetYH_FavList")
		GetYH_FavList = getResult(retXml,"GetYH_FavListResponse/GetYH_FavListResult","ArrayOfJDList")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string
	'Return:ArrayOfOrdersList
	Public Function JD_GetOrdersList(sToken,sTokenKey,sUserID)
		retXml = doWebservicesSoap("JD_GetOrdersList","sToken,sTokenKey,sUserID",Array(sToken,sTokenKey,sUserID),"http://www.jdd365.com/JD_GetOrdersList","JD_GetOrdersList")
		JD_GetOrdersList = getResult(retXml,"JD_GetOrdersListResponse/JD_GetOrdersListResult","ArrayOfOrdersList")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string
	'Return:JDDesc
	Public Function GetJDDesc(sToken,sTokenKey,sJDID)
		retXml = doWebservicesSoap("GetJDDesc","sToken,sTokenKey,sJDID",Array(sToken,sTokenKey,sJDID),"http://www.jdd365.com/GetJDDesc","GetJDDesc")
		GetJDDesc = getResult(retXml,"GetJDDescResponse/GetJDDescResult","JDDesc")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string
	'Return:JDNews
	Public Function GetJDNews(sToken,sTokenKey,sJDID)
		retXml = doWebservicesSoap("GetJDNews","sToken,sTokenKey,sJDID",Array(sToken,sTokenKey,sJDID),"http://www.jdd365.com/GetJDNews","GetJDNews")
		GetJDNews = getResult(retXml,"GetJDNewsResponse/GetJDNewsResult","JDNews")
	End Function

	'In: sToken:string,sTokenKey:string,sID:string
	'Return:JDNews
	Public Function GetJDNewsInfo(sToken,sTokenKey,sID)
		retXml = doWebservicesSoap("GetJDNewsInfo","sToken,sTokenKey,sID",Array(sToken,sTokenKey,sID),"http://www.jdd365.com/GetJDNewsInfo","GetJDNewsInfo")
		GetJDNewsInfo = getResult(retXml,"GetJDNewsInfoResponse/GetJDNewsInfoResult","JDNews")
	End Function

	'In: sToken:string,sTokenKey:string,sUser:string,sPsw:string,sWeiXinUser:string
	'Return:MyResult
	Public Function WeiXin_BindUser(sToken,sTokenKey,sUser,sPsw,sWeiXinUser)
		retXml = doWebservicesSoap("WeiXin_BindUser","sToken,sTokenKey,sUser,sPsw,sWeiXinUser",Array(sToken,sTokenKey,sUser,sPsw,sWeiXinUser),"http://www.jdd365.com/WeiXin_BindUser","WeiXin_BindUser")
		WeiXin_BindUser = getResult(retXml,"WeiXin_BindUserResponse/WeiXin_BindUserResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserName:string
	'Return:MyResult
	Public Function GetWeixin_User(sToken,sTokenKey,sUserName)
		retXml = doWebservicesSoap("GetWeixin_User","sToken,sTokenKey,sUserName",Array(sToken,sTokenKey,sUserName),"http://www.jdd365.com/GetWeixin_User","GetWeixin_User")
		GetWeixin_User = getResult(retXml,"GetWeixin_UserResponse/GetWeixin_UserResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string,MapX:string,MapY:string
	'Return:HD_GetPlaceResult
	Public Function HD_GetMyPlace(sToken,sTokenKey,sUserID,MapX,MapY)
		retXml = doWebservicesSoap("HD_GetMyPlace","sToken,sTokenKey,sUserID,MapX,MapY",Array(sToken,sTokenKey,sUserID,MapX,MapY),"http://www.jdd365.com/HD_GetMyPlace","HD_GetMyPlace")
		HD_GetMyPlace = getResult(retXml,"HD_GetMyPlaceResponse/HD_GetMyPlaceResult","HD_GetPlaceResult")
	End Function


	Function doWebservicesSoap(fn,keys,values,loc,requestType)
		Dim Envelope 
		Envelope = "<?xml version=""1.0"" encoding=""utf-8""?>"
		Envelope = Envelope & "<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/"">"
		Envelope = Envelope & "<soap:Body>"
		Envelope = Envelope & "<" & requestType & " xmlns=""" & targetNamespace & """>"
		If Keys<>"" Then
			MyKeys = Split(Keys,",")
			For i=0 to ubound(MyKeys)
				Envelope = Envelope & "<" & MyKeys(i) & ">" & values(i) & "</" & MyKeys(i) & ">"
			Next
		End If		
		Envelope = Envelope & "</" & requestType & "></soap:Body></soap:Envelope>"
		Dim WS
		Set WS = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
		WS.open "POST",Url,False
		WS.SetRequestHeader "Content-Length",len(Envelope)
		WS.SetRequestHeader "Content-Type","text/xml; charset=utf-8"
		WS.SetRequestHeader "SOAPAction",loc
		Ws.Send(Envelope)
		If Ws.ReadyState = 4 Then
			retBody = Ws.responseBody
			If Ws.status = 200 Then
				doWebservicesSoap = Bytes2Str(Ws.responseBody,Charset)
			End If
		End If
	End Function

	
	Private Function getResult(byval content,byval xpath,byval responseType)
		getResult = content
	End Function
	Private Function Bytes2Str(ByVal byt,ByVal cSet)
		If LenB(byt) = 0 Then
			Bytes2Str = ""
			Exit Function
		End If
		Dim mystream, bstr
		Set mystream =server.createobject("ADODB.Stream")
		mystream.Type = 2
		mystream.Mode = 3
		mystream.Open
		mystream.WriteText byt
		mystream.Position = 0
		mystream.CharSet = cSet
		mystream.Position = 2
		bstr = mystream.ReadText()
		mystream.Close
		Set mystream = Nothing
		Bytes2Str = bstr
	End Function
End Class
%>
回复 点赞
YYYYYYYYY-X 2014年01月26日
给你生成个!呵呵!

<%
'Class: MoWS_JD
'ServicesName: JD
'Url: http://www.jdd365.com/webservice/jd.asmx
'Created By: MoWs

Class MoWS_JD
	Public Url,Charset,targetNamespace,retXml,retBody,Method
	Private Sub Class_Initialize()
		Url = "http://www.jdd365.com/webservice/jd.asmx"
		targetNamespace = "http://www.jdd365.com/"
		Method = "Soap12"
		Charset="UTF-8"
	End Sub
	
	'In: sToken:string,sTokenKey:string,sSoftVer:string
	'Return:string
	Public Function GetAppVersion(sToken,sTokenKey,sSoftVer)
		retXml = doWebservicesSoap12("GetAppVersion","sToken,sTokenKey,sSoftVer",Array(sToken,sTokenKey,sSoftVer),"http://www.jdd365.com/GetAppVersion","GetAppVersion")
		GetAppVersion = getResult(retXml,"GetAppVersionResponse/GetAppVersionResult","string")
	End Function

	'In: sToken:string,sTokenKey:string,sSoftVer:string
	'Return:MyResult
	Public Function GetAppVersion_Android(sToken,sTokenKey,sSoftVer)
		retXml = doWebservicesSoap12("GetAppVersion_Android","sToken,sTokenKey,sSoftVer",Array(sToken,sTokenKey,sSoftVer),"http://www.jdd365.com/GetAppVersion_Android","GetAppVersion_Android")
		GetAppVersion_Android = getResult(retXml,"GetAppVersion_AndroidResponse/GetAppVersion_AndroidResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sCity:string,sDay1:string,sDay2:string,sKey:string,iPrice:int,iOrder:int,iPage:int
	'Return:JDListResult
	Public Function SearchJD(sToken,sTokenKey,sCity,sDay1,sDay2,sKey,iPrice,iOrder,iPage)
		retXml = doWebservicesSoap12("SearchJD","sToken,sTokenKey,sCity,sDay1,sDay2,sKey,iPrice,iOrder,iPage",Array(sToken,sTokenKey,sCity,sDay1,sDay2,sKey,iPrice,iOrder,iPage),"http://www.jdd365.com/SearchJD","SearchJD")
		SearchJD = getResult(retXml,"SearchJDResponse/SearchJDResult","JDListResult")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string,sDay1:string,sDay2:string
	'Return:JDXX
	Public Function GetJDXX(sToken,sTokenKey,sJDID,sDay1,sDay2)
		retXml = doWebservicesSoap12("GetJDXX","sToken,sTokenKey,sJDID,sDay1,sDay2",Array(sToken,sTokenKey,sJDID,sDay1,sDay2),"http://www.jdd365.com/GetJDXX","GetJDXX")
		GetJDXX = getResult(retXml,"GetJDXXResponse/GetJDXXResult","JDXX")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string,sFXID:string,sDay1:string,sDay2:string
	'Return:JD_FJLXEX
	Public Function GetJD_FJLX(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2)
		retXml = doWebservicesSoap12("GetJD_FJLX","sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2",Array(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2),"http://www.jdd365.com/GetJD_FJLX","GetJD_FJLX")
		GetJD_FJLX = getResult(retXml,"GetJD_FJLXResponse/GetJD_FJLXResult","JD_FJLXEX")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string,sFXID:string,sDay1:string,sDay2:string,sFS:string,sPrice:string,sRZR:string,sLXR:string,sMobile:string,sBZ:string,lsTime:string,isBill:string,sTimeTick:string
	'Return:OrdersResult
	Public Function JD_Orders(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2,sFS,sPrice,sRZR,sLXR,sMobile,sBZ,lsTime,isBill,sTimeTick)
		retXml = doWebservicesSoap12("JD_Orders","sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2,sFS,sPrice,sRZR,sLXR,sMobile,sBZ,lsTime,isBill,sTimeTick",Array(sToken,sTokenKey,sJDID,sFXID,sDay1,sDay2,sFS,sPrice,sRZR,sLXR,sMobile,sBZ,lsTime,isBill,sTimeTick),"http://www.jdd365.com/JD_Orders","JD_Orders")
		JD_Orders = getResult(retXml,"JD_OrdersResponse/JD_OrdersResult","OrdersResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUser:string,sPsw:string
	'Return:MyResult
	Public Function YH_Login(sToken,sTokenKey,sUser,sPsw)
		retXml = doWebservicesSoap12("YH_Login","sToken,sTokenKey,sUser,sPsw",Array(sToken,sTokenKey,sUser,sPsw),"http://www.jdd365.com/YH_Login","YH_Login")
		YH_Login = getResult(retXml,"YH_LoginResponse/YH_LoginResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sMobile:string,sUser:string,sPsw:string
	'Return:MyResult
	Public Function YH_Reg(sToken,sTokenKey,sMobile,sUser,sPsw)
		retXml = doWebservicesSoap12("YH_Reg","sToken,sTokenKey,sMobile,sUser,sPsw",Array(sToken,sTokenKey,sMobile,sUser,sPsw),"http://www.jdd365.com/YH_Reg","YH_Reg")
		YH_Reg = getResult(retXml,"YH_RegResponse/YH_RegResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string,sJDID:string
	'Return:MyResult
	Public Function YH_Fav(sToken,sTokenKey,sUserID,sJDID)
		retXml = doWebservicesSoap12("YH_Fav","sToken,sTokenKey,sUserID,sJDID",Array(sToken,sTokenKey,sUserID,sJDID),"http://www.jdd365.com/YH_Fav","YH_Fav")
		YH_Fav = getResult(retXml,"YH_FavResponse/YH_FavResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string,sJDID:string
	'Return:MyResult
	Public Function YH_FavDel(sToken,sTokenKey,sUserID,sJDID)
		retXml = doWebservicesSoap12("YH_FavDel","sToken,sTokenKey,sUserID,sJDID",Array(sToken,sTokenKey,sUserID,sJDID),"http://www.jdd365.com/YH_FavDel","YH_FavDel")
		YH_FavDel = getResult(retXml,"YH_FavDelResponse/YH_FavDelResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string
	'Return:ArrayOfJDList
	Public Function GetYH_FavList(sToken,sTokenKey,sUserID)
		retXml = doWebservicesSoap12("GetYH_FavList","sToken,sTokenKey,sUserID",Array(sToken,sTokenKey,sUserID),"http://www.jdd365.com/GetYH_FavList","GetYH_FavList")
		GetYH_FavList = getResult(retXml,"GetYH_FavListResponse/GetYH_FavListResult","ArrayOfJDList")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string
	'Return:ArrayOfOrdersList
	Public Function JD_GetOrdersList(sToken,sTokenKey,sUserID)
		retXml = doWebservicesSoap12("JD_GetOrdersList","sToken,sTokenKey,sUserID",Array(sToken,sTokenKey,sUserID),"http://www.jdd365.com/JD_GetOrdersList","JD_GetOrdersList")
		JD_GetOrdersList = getResult(retXml,"JD_GetOrdersListResponse/JD_GetOrdersListResult","ArrayOfOrdersList")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string
	'Return:JDDesc
	Public Function GetJDDesc(sToken,sTokenKey,sJDID)
		retXml = doWebservicesSoap12("GetJDDesc","sToken,sTokenKey,sJDID",Array(sToken,sTokenKey,sJDID),"http://www.jdd365.com/GetJDDesc","GetJDDesc")
		GetJDDesc = getResult(retXml,"GetJDDescResponse/GetJDDescResult","JDDesc")
	End Function

	'In: sToken:string,sTokenKey:string,sJDID:string
	'Return:JDNews
	Public Function GetJDNews(sToken,sTokenKey,sJDID)
		retXml = doWebservicesSoap12("GetJDNews","sToken,sTokenKey,sJDID",Array(sToken,sTokenKey,sJDID),"http://www.jdd365.com/GetJDNews","GetJDNews")
		GetJDNews = getResult(retXml,"GetJDNewsResponse/GetJDNewsResult","JDNews")
	End Function

	'In: sToken:string,sTokenKey:string,sID:string
	'Return:JDNews
	Public Function GetJDNewsInfo(sToken,sTokenKey,sID)
		retXml = doWebservicesSoap12("GetJDNewsInfo","sToken,sTokenKey,sID",Array(sToken,sTokenKey,sID),"http://www.jdd365.com/GetJDNewsInfo","GetJDNewsInfo")
		GetJDNewsInfo = getResult(retXml,"GetJDNewsInfoResponse/GetJDNewsInfoResult","JDNews")
	End Function

	'In: sToken:string,sTokenKey:string,sUser:string,sPsw:string,sWeiXinUser:string
	'Return:MyResult
	Public Function WeiXin_BindUser(sToken,sTokenKey,sUser,sPsw,sWeiXinUser)
		retXml = doWebservicesSoap12("WeiXin_BindUser","sToken,sTokenKey,sUser,sPsw,sWeiXinUser",Array(sToken,sTokenKey,sUser,sPsw,sWeiXinUser),"http://www.jdd365.com/WeiXin_BindUser","WeiXin_BindUser")
		WeiXin_BindUser = getResult(retXml,"WeiXin_BindUserResponse/WeiXin_BindUserResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserName:string
	'Return:MyResult
	Public Function GetWeixin_User(sToken,sTokenKey,sUserName)
		retXml = doWebservicesSoap12("GetWeixin_User","sToken,sTokenKey,sUserName",Array(sToken,sTokenKey,sUserName),"http://www.jdd365.com/GetWeixin_User","GetWeixin_User")
		GetWeixin_User = getResult(retXml,"GetWeixin_UserResponse/GetWeixin_UserResult","MyResult")
	End Function

	'In: sToken:string,sTokenKey:string,sUserID:string,MapX:string,MapY:string
	'Return:HD_GetPlaceResult
	Public Function HD_GetMyPlace(sToken,sTokenKey,sUserID,MapX,MapY)
		retXml = doWebservicesSoap12("HD_GetMyPlace","sToken,sTokenKey,sUserID,MapX,MapY",Array(sToken,sTokenKey,sUserID,MapX,MapY),"http://www.jdd365.com/HD_GetMyPlace","HD_GetMyPlace")
		HD_GetMyPlace = getResult(retXml,"HD_GetMyPlaceResponse/HD_GetMyPlaceResult","HD_GetPlaceResult")
	End Function


	Function doWebservicesSoap12(fn,keys,values,loc,requestType)
		Dim Envelope 
		Envelope = "<?xml version=""1.0"" encoding=""utf-8""?>"
		Envelope = Envelope & "<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"">"
		Envelope = Envelope & "<soap12:Body>"
		Envelope = Envelope & "<" & requestType & " xmlns=""" & targetNamespace & """>"
		If Keys<>"" Then
			MyKeys = Split(Keys,",")
			For i=0 to ubound(MyKeys)
				Envelope = Envelope & "<" & MyKeys(i) & ">" & values(i) & "</" & MyKeys(i) & ">"
			Next
		End If		
		Envelope = Envelope & "</" & requestType & "></soap12:Body></soap12:Envelope>"
		Dim WS
		Set WS = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
		WS.open "POST",Url,False
		WS.SetRequestHeader "Content-Length",len(Envelope)
		WS.SetRequestHeader "Content-Type","application/soap+xml; charset=utf-8"
		Ws.Send(Envelope)
		If Ws.ReadyState = 4 Then
			retBody = Ws.responseBody
			If Ws.status = 200 Then
				doWebservicesSoap12 = Bytes2Str(Ws.responseBody,Charset)
			End If
		End If
	End Function

	
	Private Function getResult(byval content,byval xpath,byval responseType)
		getResult = content
	End Function
	Private Function Bytes2Str(ByVal byt,ByVal cSet)
		If LenB(byt) = 0 Then
			Bytes2Str = ""
			Exit Function
		End If
		Dim mystream, bstr
		Set mystream =server.createobject("ADODB.Stream")
		mystream.Type = 2
		mystream.Mode = 3
		mystream.Open
		mystream.WriteText byt
		mystream.Position = 0
		mystream.CharSet = cSet
		mystream.Position = 2
		bstr = mystream.ReadText()
		mystream.Close
		Set mystream = Nothing
		Bytes2Str = bstr
	End Function
End Class
%>
回复 点赞
hookee 2014年01月25日
装个XMLSPY,用它来调试请求,可以根据wsdl自动获得正确的请求格式并查看返回值,然后在asp中按照格式拼接请求即可。
回复 点赞
孟子E章 2014年01月25日
<sToken>string</sToken><sTokenKey>string</sTokenKey><sUser>string</sUser><sPsw>string</sPsw> 要换成真实的内容,如 <sToken>xxxxx</sToken><sTokenKey>xxxxxxx</sTokenKey><sUser>Admin</sUser><sPsw>123456</sPsw> 另外,SoapRequest也没有提交啊, 另外,提交应该使用 POST方法吧 参考例子 http://blogs.msdn.com/b/kaevans/archive/2007/04/27/a-nostalgic-look-at-using-xmlhttprequest-with-soap.aspx http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript
回复 点赞
发动态
发帖子
ASP
创建于2007-09-28

1.9w+

社区成员

35.7w+

社区内容

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区公告
暂无公告