soap java 客户端_Java工作Soap客户端示例

本文提供了一个使用Java SAAJ框架创建SOAP客户端的示例,展示了如何直接处理SOAP请求和响应消息,以调用SOAP Web服务。代码详细说明了如何设置SOAP端点URL、SOAP操作以及构建SOAP消息内容。
摘要由CSDN通过智能技术生成

小编典典

要用Java实现简单的SOAP客户端,可以使用SAAJ框架(JSE 1.6及更高版本附带):

带有Java附件API的SOAP(SAAJ)主要用于直接处理任何Web Service API幕后发生的SOAP请求/响应消息。它允许开发人员直接发送和接收肥皂消息,而不是使用JAX-WS。

参见下面使用SAAJ进行SOAP Web服务调用的工作示例(运行它!)。它称为此Web服务。

import javax.xml.soap.*;

public class SOAPClientSAAJ {

// SAAJ - SOAP Client Testing

public static void main(String args[]) {

/*

The example below requests from the Web Service at:

http://www.webservicex.net/uszip.asmx?op=GetInfoByCity

To call other WS, change the parameters below, which are:

- the SOAP Endpoint URL (that is, where the service is responding from)

- the SOAP Action

Also change the contents of the method createSoapEnvelope() in this class. It constructs

the inner part of the SOAP envelope that is actually sent.

*/

String soapEndpointUrl = "

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值