package demo.test;

import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName; import org.tempuri.ReservationService;
import org.tempuri.ReservationServiceSoap; import com.micros.webservices.og._4_3.common.Text;
import com.micros.webservices.og._4_3.common.UniqueID;
import com.micros.webservices.og._4_3.common.UniqueIDType;
import com.micros.webservices.og._4_3.core.EndPoint;
import com.micros.webservices.og._4_3.core.OGHeader;
import com.micros.webservices.og._4_3.hotelcommon.CancelTerm;
import com.micros.webservices.og._4_3.hotelcommon.CancelTermType;
import com.micros.webservices.og._4_3.hotelcommon.GDSResultStatus;
import com.micros.webservices.og._4_3.hotelcommon.HotelReference;
import com.micros.webservices.og._4_3.hotelcommon.Paragraph;
import com.micros.webservices.ows._5_1.reservation.CancelBookingRequest;
import com.micros.webservices.ows._5_1.reservation.CancelBookingResponse; public class Demo1 {
public static void main(String[] args) {
System.setProperty("http.proxySet", "true"); System.setProperty("http.proxyHost", "127.0.0.1"); System.setProperty("http.proxyPort", "8888");
ReservationService service = new ReservationService(); ReservationServiceSoap soap = service.getReservationServiceSoap();
CancelBookingRequest cancelBookingRequest = new CancelBookingRequest(); HotelReference ref = new HotelReference();
ref.setChainCode("ChainCodeXX");
ref.setHotelCode("HotelCodeXX");
cancelBookingRequest.setHotelReference(ref);
UniqueID num = new UniqueID();
num.setValue("220804");
num.setType(UniqueIDType.INTERNAL);
cancelBookingRequest.setConfirmationNumber(num); cancelBookingRequest.setLastName("ZHANG SANSI"); CancelTerm cancel = new CancelTerm();
cancel.setCancelType(CancelTermType.CANCEL);
cancel.setCancelReasonCode("Cancel");
Paragraph pa = new Paragraph();
Text txt = new Text();
txt.setValue("测试取消");
JAXBElement<Text> t = new JAXBElement<Text>(new QName(
"http://webservices.micros.com/og/4.3/HotelCommon/", "Text"),
Text.class, txt);
pa.getURLOrTextOrImage().add(t);
cancelBookingRequest.setCancelTerm(cancel); OGHeader header = new OGHeader();
header.setTransactionID("000032");
EndPoint orgin = new EndPoint();
orgin.setEntityID("ChannelCodeXX");
orgin.setSystemType("WEB");
header.setOrigin(orgin);
EndPoint des = new EndPoint();
des.setEntityID("ORS");
des.setSystemType("ORS");
header.setDestination(des);
CancelBookingResponse res = soap.cancelBooking(header,
cancelBookingRequest);
GDSResultStatus status = res.getResult();
System.out.println(status.getResultStatusFlag()); System.out.print("-------------");
System.out.println(status.getGDSError().getValue());
}
}
package org.tempuri;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import cn.net.chinaonline.webservices._switch._1_5_1.reservation.CreateBookingRequest;
import cn.net.chinaonline.webservices._switch._1_5_1.reservation.ModifyBookingRequest; import com.micros.webservices.og._4_3.core.OGHeader;
import com.micros.webservices.ows._5_1.reservation.CancelBookingRequest;
import com.micros.webservices.ows._5_1.reservation.CancelBookingResponse;
import com.micros.webservices.ows._5_1.reservation.CreateBookingResponse;
import com.micros.webservices.ows._5_1.reservation.FetchBookingStatusRequest;
import com.micros.webservices.ows._5_1.reservation.FetchBookingStatusResponse;
import com.micros.webservices.ows._5_1.reservation.ModifyBookingResponse; /**
* This class was generated by the JAX-WS RI. JAX-WS RI 2.1.6 in JDK 6 Generated
* source version: 2.1
*
*/
@WebService(name = "ReservationServiceSoap", targetNamespace = "http://tempuri.org/")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
com.micros.webservices.og._4_3.name.ObjectFactory.class,
cn.net.chinaonline.webservices._switch._1_5_1.reservation.ObjectFactory.class,
com.micros.webservices.og._4_3.membership.ObjectFactory.class,
com.micros.webservices.ows._5_1.reservation.ObjectFactory.class,
com.micros.webservices.og._4_3.common.ObjectFactory.class,
com.micros.webservices.og._4_3.core.ObjectFactory.class,
com.micros.webservices.og._4_3.reservation.ObjectFactory.class,
com.micros.webservices.og._4_3.hotelcommon.ObjectFactory.class,
com.micros.webservices.og._4_3.activity.ObjectFactory.class })
public interface ReservationServiceSoap { /**
*
* @param fetchBookingStatusRequest
* @return returns
* com.micros.webservices.ows._5_1.reservation.FetchBookingStatusResponse
*/
@WebMethod(operationName = "FetchBookingStatus", action = "http://webservices.micros.com/ows/5.1/Reservation.wsdl#FetchBookingStatus")
@WebResult(name = "FetchBookingStatusResponse", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "FetchBookingStatusResult")
public FetchBookingStatusResponse fetchBookingStatus(
@WebParam(name = "FetchBookingStatusRequest", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "FetchBookingStatusRequest") FetchBookingStatusRequest fetchBookingStatusRequest); /**
*
* @param createBookingRequest
* @return returns
* com.micros.webservices.ows._5_1.reservation.CreateBookingResponse
*/
@WebMethod(operationName = "CreateBooking", action = "http://webservices.micros.com/ows/5.1/Reservation.wsdl#CreateBooking")
@WebResult(name = "CreateBookingResponse", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "CreateBookingResult")
public CreateBookingResponse createBooking(
@WebParam(name = "CreateBookingRequest", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "CreateBookingRequest") CreateBookingRequest createBookingRequest); /**
*
* @param modifyBookingRequest
* @return returns
* com.micros.webservices.ows._5_1.reservation.ModifyBookingResponse
*/
@WebMethod(operationName = "ModifyBooking", action = "http://webservices.micros.com/ows/5.1/Reservation.wsdl#ModifyBooking")
@WebResult(name = "ModifyBookingResponse", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "ModifyBookingResult")
public ModifyBookingResponse modifyBooking(
@WebParam(name = "ModifyBookingRequest", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "ModifyBookingRequest") ModifyBookingRequest modifyBookingRequest); /**
*
* @param cancelBookingRequest
* @return returns
* com.micros.webservices.ows._5_1.reservation.CancelBookingResponse
*/
@WebMethod(operationName = "CancelBooking", action = "http://webservices.micros.com/ows/5.1/Reservation.wsdl#CancelBooking")
@WebResult(name = "CancelBookingResponse", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "CancelBookingResult")
public CancelBookingResponse cancelBooking(
@WebParam(name = "OGHeader", targetNamespace = "http://webservices.micros.com/og/4.3/Core/", partName = "OGHeader") OGHeader header,
@WebParam(name = "CancelBookingRequest", targetNamespace = "http://webservices.micros.com/ows/5.1/Reservation.wsdl", partName = "CancelBookingRequest") CancelBookingRequest cancelBookingRequest); }
@WebParam(name = "OGHeader", targetNamespace = "http://webservices.micros.com/og/4.3/Core/", partName = "OGHeader") OGHeader header,

这一段代码是要另外加的。

带有Header的SOAP 请求的更多相关文章

  1. Java发布一个简单 webservice应用 并发送SOAP请求

    一.创建并发布一个简单的webservice应用 1.webservice 代码: package com.ls.demo; import javax.jws.WebMethod; import ja ...

  2. Java发布webservice应用并发送SOAP请求调用

    webservice框架有很多,比如axis.axis2.cxf.xFire等等,做服务端和做客户端都可行,个人感觉使用这些框架的好处是减少了对于接口信息的解析,最主要的是减少了对于传递于网络中XML ...

  3. PHP用post来进行Soap请求

    最近调了一个Soap请求C# webservice的项目.网上坑不少. 使用原生的SoapClient库请求也是失败.只好用post来进行模拟了.代码贴出来,给大家参考一下. <?php nam ...

  4. [Postman]发出SOAP请求(18)

    使用Postman发出SOAP请求: 将SOAP端点作为URL.如果您使用的是WSDL,那么请将WSDL的路径作为URL. 将请求方法设置为POST. 打开原始编辑器,并将正文类型设置为“text / ...

  5. C# httpRequest Soap请求

    一般添加web服务引用是.NET用代理类模式 创建SOAP请求代理类,代理类是.NET开发工具VS自动给你生成. 下面用一般HTTP的模式有时候可能更合适,原理是构造SOAP请求的XML后POST过去 ...

  6. Web Service之Soap请求响应内容中文编码解密

    java模拟Soap请求测试Web Service接口,发现Web Service响应内容中的中文竟然是编码格式.比如: 中文:退保成功 Soap中文编码:退保成功   我仔细分析后发现,退编码实际上 ...

  7. jmeter——http、jdbc、soap请求

    1.jmeter——http 请求 1.1添加线程组 1.2添加http请求 1.3发起http请求 1.协议:通常一个http请求都会有相对应的协议,如HTTP,HTTPS等.这里除非有特殊要求,一 ...

  8. Axis2(10):使用soapmonitor模块监视soap请求与响应消息

    在Axis2中提供了一个Axis2模块(soapmonitor),该模块实现了与<WebService大讲堂之Axis2(9):编写Axis2模块(Module)>中实现的logging模 ...

  9. java 查看SOAP请求报文

    log.info("ESB 请求URL = " + cachedEndpoint.toString());//打印SOAP请求报文 add by LinJC on 20170120 ...

随机推荐

  1. MAC下是用brew安装Redis

    启动redis redis-server /etc/redis.conf 安装brew 在命令行里运行下面的命令,需要等待一段时间. ruby -e "$(curl -fsSL https: ...

  2. C# 跳转新页面

    C# 跳转新页面 string url = "http://www.vipsoft.com.cn"; ResponseRedirect.Redirect(Response, url ...

  3. AlphaGo论文的译文,用深度神经网络和树搜索征服围棋:Mastering the game of Go with deep neural networks and tree search

    转载请声明 http://blog.csdn.net/u013390476/article/details/50925347 前言: 围棋的英文是 the game of Go,标题翻译为:<用 ...

  4. === $ spark sql 的特别的方法

    /** * Equality test. * {{{ * // Scala: * df.filter( df("colA") === df("colB") ) ...

  5. 【WPF】使用控件MediaElement播放视频

    需求是点击按钮后,弹出弹窗播放视频.按钮的点击事件如下. public void ShowVideo() { Window window = new Window(); window.Width = ...

  6. ubuntu 14.04 gitlab 的搭建

    经过两天的尝试,gitlab 终于在 ubuntu14.04 上面搭建起来. 一.安装相关软件. // 执行如下命令: sudo apt-get install vim git curl openss ...

  7. JMeter (3) —— JMeter录制脚本并压力测试用户登陆场景以CAS SSO为例(101 Tutorial)

    JMeter (3) -- JMeter录制脚本并压力测试用户登陆场景以CAS SSO为例(101 Tutorial) 主要内容 JMeter录制脚本并进行压力测试用户登陆场景,并以CAS SSO单点 ...

  8. CAS (8) —— Mac下配置CAS到JBoss EAP 6.4(6.x)的Standalone模式(服务端)

    CAS (8) -- Mac下配置CAS到JBoss EAP 6.4(6.x)的Standalone模式(服务端) jboss版本: jboss-eap-6.4-CVE-2015-7501 jdk版本 ...

  9. QPushButton取消按压后文字下沉效果

    1.下沉原因 1.1.QPushButton源码 void QPushButton::initStyleOption(QStyleOptionButton *option) const { if (d ...

  10. POST数据时400错误

    第一种解决办法是关闭Csrf public function init(){ $this->enableCsrfValidation = false; } 第二种解决办法是在form表单中加入隐 ...