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. jetty el表达式不支持三元运算

    在jetty跑web程序中不支持三元运算 要换一种格式写 这种代码在jsp页面用jetty跑起来是会报错的,然后调换一下顺序就可以了  或者在后面那个加个括号也可以 

  2. 设计模式之开放-封闭原则(引申出Objective-C中继承、Category、Protocol三者的区别,这点面试常问)

    开放封闭原则(OCP原则The Open-Closed Principle)是面向对象的核心设计所在.它是说,软件开发实体(类.模块.函数等)应该可以扩展,但是不能修改. 这个原则有两个特征,一个是说 ...

  3. pandas 常用函数整理

    pandas常用函数整理,作为个人笔记. 仅标记函数大概用途做索引用,具体使用方式请参照pandas官方技术文档. 约定 from pandas import Series, DataFrame im ...

  4. 腾讯云CentOS 安装 Hadoop 2.7.3

    1.安装 jdk yum install java 2.安装maven wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.0/binar ...

  5. windows已阻止此软件因为无法验证发行者怎么办

    出现提示windows已阻止此软件因为无法验证发行者怎么解决?有的时候访问某些网站会出现类似的提示.导致不能正常运行某个插件,遇到这个问题一般是浏览器的安全级别设置太高了,没有允许脚本控件运行   设 ...

  6. metrics 开发监控实现jdbc

    Metrics 主要有五大基本组件1:Counter  记录执行次数2:Gauge  获取某个值3:Meter  用来计算事件的速率4:Histogram  可以为数据流提供统计数据. 除了最大值,最 ...

  7. drupal 精彩文章

    1.如何快速查找Drupal表单的Form ID?http://www.drupalla.com/node/2306

  8. SpringBoot2 @validated 自定义效验类型

    项目参考:详细参见:<Spring Boot 2精髓:从构建小系统到架构分布式大系统> 第三章 3.5.3节 自定义校验 项目结构 WorkTime package com.archibl ...

  9. MongoDB 运行状态、性能监控,分析

    这篇文章的目的是让你知道怎么了解你正在运行的Mongdb是否健康.转载自http://tech.lezi.com/archives/290 mongostat详解 启动mongodb监控,通过下面命令 ...

  10. Altium Designer 规则设置

    设计规则设置 Designer Rules Check(DRC) Electrical 电气规则.安全间距,线网连接等 Routing 布线,线宽.过孔形状尺寸.布线拓扑.布线层.封装出线等 SMT ...