1309259209 1309259209
IT民工
关注数: 5 粉丝数: 31 发帖数: 598 关注贴吧数: 9
jsp页面调用C# ws (带参数) 图片是ws,我现在在jsp页面调用不知道怎么穿参数,望大神指点 jsp代码 String soapRequestData = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap12:Envelope xmlns:xsi=\"http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&urlrefer=8c31805956ebb9a7292762c26181562e\" " + "xmlns:xsd=\"http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema&urlrefer=4a2e1d7635322aa5e1be3b11e9a1f975\" " + "xmlns:soap12=\"http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fwww.w3.org%2F2003%2F05%2Fsoap-envelope&urlrefer=82409dca6cd98b0b5c377f30f286e493\">" + " <soap12:Body>" + " <HelloWorld xmlns=\"http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Ftempuri.org%2F&urlrefer=06411e8004d0c8a82716d68a9cc72ee8\" />" + " </soap12:Body>" +"</soap12:Envelope>"; out.println("hh"+soapRequestData.getBytes("utf-8").length); PostMethod postMethod = new PostMethod( "http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Flocalhost%3A51459%2FTestZhuCe.asmx%3Fop%3DHelloWorld&urlrefer=1d6edc942a29ca7ad0b27a9b82bd2897"); //然后把Soap请求数据添加到PostMethod中 byte[] b = soapRequestData.getBytes("utf-8"); InputStream is = new ByteArrayInputStream(b, 0, b.length); RequestEntity re = new InputStreamRequestEntity(is, b.length, "application/soap+xml; charset=utf-8"); postMethod.setRequestEntity(re); //最后生成一个HttpClient对象,并发出postMethod请求 HttpClient httpClient = new HttpClient(); httpClient.executeMethod(postMethod); //out.println(postMethod.getResponseBodyAsString() ); String soapString = postMethod.getResponseBodyAsString(); MessageFactory msgFactory; msgFactory = MessageFactory .newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); SOAPMessage reqMsg = msgFactory.createMessage( new MimeHeaders(), new ByteArrayInputStream(soapString.getBytes("UTF-8"))); reqMsg.saveChanges(); SOAPBody sbody = reqMsg.getSOAPBody();
1 下一页