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. LVS负载均衡模型及算法概述

    集群类型 LB: Load Balancing,负载均衡 HA:High Availability, 高可用 HP:High Performance, 高性能   负载均衡 负载均衡设备 Hardwa ...

  2. zmap blacklist

    # From IANA IPv4 Special-Purpose Address Registry# http://www.iana.org/assignments/iana-ipv4-special ...

  3. 【WPF】绑定Hyperlink超链接

    Hyperlink超链接的简单使用 前台XAML: <TextBlock> 说明文字: <Hyperlink NavigateUri="http://www.qq.com& ...

  4. RPC框架与分布式服务框架的区别

    第一:RPC框架是点对点的通信方式,即服务消费者与服务提供者是点对点通信 第二:分布式服务框架,不近具有RPC框架的特性,同时,还包括以下特性: 1.提供多台服务器提供服务,具有负载均衡策略 2.服务 ...

  5. 推荐几个不错的h5游戏引擎

    http://www.phaser.io/examples http://www.cocos.com/ http://cn.cocos2d-x.org/tutorial/lists?id=30 coc ...

  6. MVC源码学习之AuthorizeAttribute

    常见的Controller定义方式: public class HomeController : Controller { public ActionResult Index() { return V ...

  7. java操作大文件复制

    https://www.cnblogs.com/coprince/p/6594348.html https://blog.csdn.net/w592376568/article/details/796 ...

  8. win10 oracle11g彻底删除

    参考以下两篇: 卸载oracle11g步骤: 1.首先关掉所有oracle的相关服务,然后找到oracle的卸载程序Universal Installer:  然后点击卸载产品,然后点击展开全部,将主 ...

  9. j解决sparkr中使用某些r的原生函数 发生错误Error: class(objId) == "jobj" is not TRUE的问题

    Create table function in Spark in R not working João_Andre  (3) 询问的问题 | 2016年12月10日 06:03BLUEMIXRSPA ...

  10. 【转】android如何实现开机自动启动Service或app

    1.今天我们主要来探讨android怎么让一个service开机自动启动功能的实现.Android手机在启动的过程中会触发一个Standard Broadcast Action,名字叫android. ...