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. Notepad++的右键菜单

    这种方法可以重复利用,如果下次它又消失了,你可以再导入一次就OK了.比如我们创建一个叫 notepad++.reg的文件,将下面的内容拷贝进去保存 Windows Registry Editor Ve ...

  2. 【Java】定义魔法数字,以及枚举类的构造方法的使用

    JavaWeb项目中需要定义各种常量时,常用方法有: 写到Property配置文件中,用静态代码块优先加载配置文件.参考http://www.cnblogs.com/guxin/p/java-prop ...

  3. mac键盘图表大全

    Mac键盘图标与对应快捷按键 ⌘——Command () ⌃ ——Control ⌥——Option (alt) ⇧——Shift ⇪——Caps Lock fn——功能键就是fn *.m*.h切换 ...

  4. for语句练习 阶乘

    4的阶乘:4!=1*2*3*4 public class g { /** * @param args */ public static void main(String[] args) { int n ...

  5. Vagrant (2) —— 基本安装与配置(下)

    Vagrant (2) -- 基本安装与配置(下) 摘要 基本安装与配置 版本 Vagrant版本: 1.8.1 内容 预置 我们可以通SSH登录然后安装一个web服务器,但是这样每个使用Vagran ...

  6. Spark SQL讲解

    Spark SQL讲解 Spark SQL是支持在Spark中使用Sql.HiveSql.Scala中的关系型查询表达式.它的核心组件是一个新增的RDD类型SchemaRDD,它把行对象用一个Sche ...

  7. android开发(41) Fragment中使用POP_BACK_STACK_INCLUSIVE达到一次跳转到栈底。类似Activity的 采用FLAG_ACTIVITY_CLEAR_TOP

    需求场景: 在开发中遇到下面这样场景: 1.创建 Fragment A 显示.  这时栈的结构是: .Fragment A 2.创建 Fragment B 并 显示.  从下到上看,这时栈的结构是: ...

  8. java中unicode和中文相互转换

    package test.com.gjob.services; import java.util.Properties; public class Test { public static void ...

  9. 一些有用的js插件

    getfuelux.com  一系列插件合集 Ion.RangeSlider 超级牛的范围选择控件 Ion.CheckRadio Ion.Tabs Ion.Calendar Ion.ImageSlid ...

  10. Java设计模式(13)模板模式(Template模式)

    Template模式定义:定义一个操作中算法的骨架,将一些步骤的执行延迟到其子类中. 其实Java的抽象类本来就是Template模式,因此使用很普遍.而且很容易理解和使用,我们直接以示例开始: pu ...