java调用peopleSoft webservice
来源:互联网 发布:网络上说表妹什么意思 编辑:程序博客网 时间:2024/06/04 03:57
1、peopleSoft系统webservice发布成功后,会提供一个wsdl URL地址,如:
5、测试运行环境:
http://IP:port/PSIGW/PeopleSoftServiceListeningConnector/PSFT_HR/xxxxx.1.wsdl
2、利用SOAPUI工具,可查看出SOAP请求XML,
3、java客户端可以模拟SOAP请求,注意以下几点:
3.1 请求URL地址并非是wsdl地址,而是“http://IP:port/PSIGW/PeopleSoftServiceListeningConnector/XXX”
3.2 请求时需要设置请求的header,SOAPAction=XXXXX,
3.3 遵循SOAPUI中的RAW窗口展示的请求方式,如下图
4、代码实现如下:
import java.io.ByteArrayInputStream;import java.io.IOException;import java.io.InputStream;import java.io.UnsupportedEncodingException;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.HttpException;import org.apache.commons.httpclient.methods.InputStreamRequestEntity;import org.apache.commons.httpclient.methods.PostMethod;import org.w3c.dom.Document;public class WebServiceClient {public static void main(String[] args) throws Exception {test2();}public static void test2() throws Exception {String soapRequestData = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:bl='http://xmlns.oracle.com/Enterprise/Tools/schemas/BL_MRYSTS_REQAPRVL_REQ.V1'> "+ " <soapenv:Header/> "+ " <soapenv:Body> "+ " <parameter> "+ " <bl:EMPLID>10086</bl:EMPLID> "+ " <bl:APRVLSTS>SUB</bl:APRVLSTS>"+ " <bl:MRYSTS>S</bl:MRYSTS>"+ " </parameter>"+ " </soapenv:Body>" + " </soapenv:Envelope>";System.out.println("soapRequestData=" + soapRequestData);PostMethod postMethod = new PostMethod("http://IP:port/PSIGW/PeopleSoftServiceListeningConnector/PSFT_HR");try {byte[] b = soapRequestData.getBytes("utf-8");InputStream is = new ByteArrayInputStream(b, 0, b.length);org.apache.commons.httpclient.methods.RequestEntity re = new InputStreamRequestEntity(is, b.length,"text/xml;charset=utf-8");postMethod.setRequestEntity(re);postMethod.setRequestHeader("SOAPAction", "BL_MRYSTS_REQAPRVL.v1");HttpClient httpClient = new HttpClient();int status = httpClient.executeMethod(postMethod);InputStream in = postMethod.getResponseBodyAsStream();DocumentBuilderFactory bf = DocumentBuilderFactory.newInstance();DocumentBuilder db = bf.newDocumentBuilder();Document document = db.parse(in);String res = document.getElementsByTagName("ResponseInfo").item(0).getTextContent();System.out.println(res);System.out.println(in);System.out.println(status);} catch (UnsupportedEncodingException e) {e.printStackTrace();} catch (HttpException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}}}
5、测试运行环境:
JDK1.7,
所需jar包,maven地址如下:
<dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.1.1</version></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.4</version></dependency><dependency><groupId>commons-httpclient</groupId><artifactId>commons-httpclient</artifactId><version>3.1</version></dependency>
0 0
- java调用peopleSoft webservice
- 【webservice】Java调用WebService
- Java中调用WebService
- java调用webService例子
- java调用webservice XFire!
- java 如何调用webservice
- java调用webservice
- java调用webservice XFire
- java调用webservice
- java调用webservice
- java调用.net Webservice
- java调用webservice axis
- java调用webService相关
- java调用webservice XFire
- Java调用.net webservice
- java webservice 调用
- C#调用java webservice
- java 调用.net webService
- qml文件如何查看效果
- 【c++】复合类型
- BlockingQueue的原理浅析及其在项目中的应用
- 尚硅谷java学习笔记——10.java IO流
- Android中让TextView的字体部分显示颜色
- java调用peopleSoft webservice
- 不调用具有"协程特性"的系统API函数而使用汇编实现协程
- C 语言入门 慕课网
- 详细图解mongodb 3.4.1 win7x64下载、安装、配置与使用2017/01/16
- List list = new ArrayList();和ArrayList list=new ArrayList();的区别?
- 用JS,JQuery格式化日期或者Select标签的选项
- 前端学习笔记-HTML(二)
- [ATL/WTL]_[初级]_[选择目录对话框]
- SQL 事务