I am new to webservice and WS Security. I have a sample webservice using CFX interceptor. Following is the config file I have.
Cfx-servelet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint
id="doubleit"
implementor="service.DoubleItPortTypeImpl"
address="/doubleit" >
<!-- Uncomment only if using WS-SecurityPolicy
<jaxws:properties>
<entry key="ws-security.callback-handler" value-ref="myPasswordCallback"/>
</jaxws:properties>
-->
<!-- Uncomment only if using standard WSS4J interceptors -->
<jaxws:inInterceptors>
<bean
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken"/>
<entry key="passwordType" value="PasswordText"/>
<entry key="passwordCallbackRef" value-ref="myPasswordCallback"/>
</map>
</constructor-arg>
</bean>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean id="myPasswordCallback" class="service.ServerPasswordCallback" />
</beans>
When I generated security attribute in the HTTP headers (not in the message payload) using soapUI tool, it worked. But I need to pass the wsse:security attribute in message payload (something like below)
soap request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:doub="http://www.example.org/schema/DoubleIt">
<soapenv:Header>
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis- open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-27777511" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>joe</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">joespassword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<doub:DoubleIt>
<numberToDouble>10</numberToDouble>
</doub:DoubleIt>
</soapenv:Body>
</soapenv:Envelope>
It is giving fault message back:
Soap Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Fault occurred while processing.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Log file has the following exception:
2014-03-07 15:44:20,438 [http-8080-1] WARN org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://www.example.org/contract/DoubleIt}DoubleItService has thrown exception, unwinding now
java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.getDocument(StaxUtils.java:944)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:981)
at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SAAJInInterceptor.java:223)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.getSOAPMessage(WSS4JInInterceptor.java: 154)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:203)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:89)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:209)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:191)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.connecture.stateadvantage.ui.healthplanmanagement.PublicResourceFilter.doFilter(PublicResourceFilter.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.connecture.services.planservice.ui.PublicResourceFilter.doFilter(PublicResourceFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.connecture.services.applicationservice.ui.PublicResourceFilter.doFilter(PublicResourceFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at com.connecture.securityservice.ui.SecAnonymousAuthenticationFilter.doFilter(SecAnonymousAuthenticationFilter.java:51)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at com.connecture.securityservice.ui.SecureLoginCookieFilter.doFilter(SecureLoginCookieFilter.java:122)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at com.connecture.stateadvantage.ui.common.TimerFilter.doFilter(TimerFilter.java:37)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)
at java.lang.Thread.run(Unknown Source)
Can any one tell me whether I am doing something wrong with the header? Any help would be appreciated.
Thanks
In the "soap request:" example you have provided, there are two problems:
There are duplicate <soapenv:Header> tags
There is whitespace in xmlns:wsse="http://docs.oasis- open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
Related
Below http:outbound-endpoint returns the expected response as CDATA but when i change it to http:request it returns the whole SOAP message instead of just CDATA. I don't want to write any custom code to extract the CDATA.
Any help is appreciated!
Flow works with http:outbound-endpoint:
<flow name="Client">
<logger message="REQUEST : #[payload]" level="WARN"/>
<http:outbound-endpoint exchange-pattern="request-response" address="http://server:8080/RoomStatusService/webservices.asmx" >
<cxf:jaxws-client clientClass="com.test.webservices.WebServices" operation="UpdateRoomStatus" port="WebServicesSoap" />
</http:outbound-endpoint>
<logger message="RESPONSE : #[payload]" level="WARN"/>
</flow>
Expected Response:
REQUEST : <?xml version="1.0" encoding="UTF-8" standalone="yes"?><RoomStatusDetail><InspBy>AUTO</InspBy><RoomNumber>402</RoomNumber><RoomStatus>3</RoomStatus><Wing>ST</Wing></RoomStatusDetail>
RESPONSE : <UpdateRoomStatusResult><RoomStatusDetail>Room updated.</RoomStatusDetail></UpdateRoomStatusResult>
Flow doesn't work with http:request:
<http:request-config name="CONFIG" host="server" port="8080" doc:name="HTTP Request Configuration"/>
<flow name="Client">
<logger message="REQUEST : #[payload]" level="WARN"/>
<cxf:jaxws-client clientClass="com.test.webservices.WebServices" operation="UpdateRoomStatus" port="WebServicesSoap" />
<http:request config-ref="CONFIG" path="RoomStatusService/webservices.asmx" method="POST" doc:name="HTTP" >
<http:success-status-code-validator values="0..599"/>
</http:request>
<logger message="RESPONSE : #[payload]" level="WARN"/>
</flow>
Incorrect Response:
REQUEST : <?xml version="1.0" encoding="UTF-8" standalone="yes"?><RoomStatusDetail><InspBy>AUTO</InspBy><RoomNumber>402</RoomNumber><RoomStatus>3</RoomStatus><Wing>ST</Wing></RoomStatusDetail>
RESPONSE : <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><UpdateRoomStatusResponse xmlns="http://testsoftware.com/webservices/"><UpdateRoomStatusResult><UpdateRoomStatusResult><RoomStatusDetail>Room updated.</RoomStatusDetail></UpdateRoomStatusResult></UpdateRoomStatusResult></UpdateRoomStatusResponse></soap:Body></soap:Envelope>
Sample Request & Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://testsoftware.com/webservices/">
<soapenv:Header/>
<soapenv:Body>
<web:UpdateRoomStatus>
<web:UpdateRoomStatusRequest><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="yes"?><RoomStatusDetail><Wing>ET</Wing><RoomNumber>50102</RoomNumber><RoomStatus>1</RoomStatus><InspBy>test</InspBy></RoomStatusDetail>]]></web:UpdateRoomStatusRequest>
</web:UpdateRoomStatus>
</soapenv:Body>
</soapenv:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<UpdateRoomStatusResponse xmlns="http://testsoftware.com/webservices/">
<UpdateRoomStatusResult><UpdateRoomStatusResult><RoomStatusDetail>Room updated.</RoomStatusDetail></UpdateRoomStatusResult></UpdateRoomStatusResult>
</UpdateRoomStatusResponse>
</soap:Body>
</soap:Envelope>
http:outbound is not doing anything but it is the tag which removes the SOAP envelope around the response. If you are consuming SOAP web service, better use Web service consumer.
You can use replace function to remove soap envelope like as below.Once you receive the payload ,use Set payload :
#[message.payloadAs(String).replace('<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<UpdateRoomStatusResponse xmlns="http://testsoftware.com/webservices/">','')]
and again use replace function to remove end part of Soap envelope and then pretty print the response
<mulexml:xml-prettyprinter-transformer xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" newlines="false" indentEnabled="false" padText="false" trimText="true"/>
I'm trying to do Issue Air Ticket workflow, but AirTicketLLSRQ returns error:
PNR HAS BEEN UPDATED-IGN AND RETRY-0049
Before this, I'm creating PNR with PassengerDetailsRQ method.
Request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<MessageHeader xmlns="http://www.ebxml.org/namespaces/messageHeader">
<From>
<PartyId>WebServiceClient</PartyId>
</From>
<To>
<PartyId>WebServiceSupplier</PartyId>
</To>
<CPAId>4PFI</CPAId>
<ConversationId>SWS-Test-4PFI</ConversationId>
<Service>PassengerDetails</Service>
<Action>PassengerDetailsRQ</Action>
<MessageData>
<MessageId>9314594d-6c40-406b-9029-b887b13906b6</MessageId>
<Timestamp>2017-07-11T08:57:38Z</Timestamp>
</MessageData>
</MessageHeader>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
<BinarySecurityToken>
Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!-3255696707179766905!1188118!0
</BinarySecurityToken>
</Security>
</soap:Header>
<soap:Body>
<PassengerDetailsRQ xmlns="http://services.sabre.com/sp/pd/v3_3" version="3.3.0" IgnoreOnError="false"
HaltOnError="false">
<PostProcessing IgnoreAfter="false" RedisplayReservation="true">
<EndTransactionRQ>
<EndTransaction Ind="true">
<Email Ind="true">
<Itinerary Ind="true">
<PDF Ind="true"/>
<Segment Number="1"/>
</Itinerary>
</Email>
</EndTransaction>
<Source ReceivedFrom="TEST"/>
</EndTransactionRQ>
</PostProcessing>
<SpecialReqDetails>
<AddRemarkRQ>
<RemarkInfo>
<Remark Code="H" SegmentNumber="1" Type="General">
<Text>TEXT</Text>
</Remark>
</RemarkInfo>
</AddRemarkRQ>
<SpecialServiceRQ>
<SpecialServiceInfo>
<AdvancePassenger SegmentNumber="A">
<!-- 2. a legal LLS request -->
<Document ExpirationDate="2018-05-26" Number="1234567890" Type="P">
<IssueCountry>FR</IssueCountry>
<NationalityCountry>FR</NationalityCountry>
</Document>
<PersonName DateOfBirth="1980-12-02" Gender="M" NameNumber="1.1" DocumentHolder="true">
<GivenName>JAMES</GivenName>
<MiddleName>MALCOLM</MiddleName>
<Surname>GREEN</Surname>
</PersonName>
<VendorPrefs>
<Airline Hosted="false"/>
</VendorPrefs>
</AdvancePassenger>
<SecureFlight SegmentNumber="A">
<PersonName DateOfBirth="1980-12-02" Gender="M" NameNumber="1.1">
<GivenName>JAMES</GivenName>
<Surname>GREEN</Surname>
</PersonName>
</SecureFlight>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ>
<AgencyInfo>
<Address>
<AddressLine>SABRE TRAVEL</AddressLine>
<CityName>SOUTHLAKE</CityName>
<CountryCode>US</CountryCode>
<PostalCode>76092</PostalCode>
<StateCountyProv StateCode="TX"/>
<StreetNmbr>3150 SABRE DRIVE</StreetNmbr>
<VendorPrefs>
<Airline Hosted="true"/>
</VendorPrefs>
</Address>
<Ticketing TicketType="7T-"/>
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber Phone="817-555-1212" PhoneUseType="A"/>
</ContactNumbers>
<Email Address="yury.patrin#gmail.com" NameNumber="1.1"/>
<PersonName NameNumber="1.1">
<GivenName>JAMES</GivenName>
<Surname>GREEN</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
</soap:Body>
</soap:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0" soap-env:mustUnderstand="1">
<eb:From>
<eb:PartyId eb:type="URI">WebServiceSupplier</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId eb:type="URI">WebServiceClient</eb:PartyId>
</eb:To>
<eb:CPAId>4PFI</eb:CPAId>
<eb:ConversationId>SWS-Test-4PFI</eb:ConversationId>
<eb:Service>PassengerDetails</eb:Service>
<eb:Action>PassengerDetailsRS</eb:Action>
<eb:MessageData>
<eb:MessageId>1i9226s68</eb:MessageId>
<eb:Timestamp>2017-07-11T08:50:23</eb:Timestamp>
<eb:RefToMessageId>9314594d-6c40-406b-9029-b887b13906b6</eb:RefToMessageId>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">
Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!-3255696707179766905!1188118!0
</wsse:BinarySecurityToken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body>
<PassengerDetailsRS xmlns="http://services.sabre.com/sp/pd/v3_3">
<ApplicationResults xmlns="http://services.sabre.com/STL_Payload/v02_01" status="Complete">
<Success timeStamp="2017-07-11T03:50:23.635-05:00"/>
<Warning type="BusinessLogic" timeStamp="2017-07-11T03:50:23.469-05:00">
<SystemSpecificResults>
<Message code="WARN.SWS.HOST.WARNING_RESPONSE">EndTransactionLLSRQ: TTY REQ PEND</Message>
</SystemSpecificResults>
</Warning>
</ApplicationResults>
<ItineraryRef ID="PGAAHT"/>
<TravelItineraryReadRS>
<TravelItinerary>
<CustomerInfo>
<Address>
<AddressLine type="N">SABRE TRAVEL</AddressLine>
<AddressLine type="A">3150 SABRE DRIVE</AddressLine>
<AddressLine type="C">SOUTHLAKE, TX US</AddressLine>
<AddressLine type="Z">76092</AddressLine>
</Address>
<ContactNumbers>
<ContactNumber LocationCode="IEV" Phone="817-555-1212-A" RPH="001"/>
</ContactNumbers>
<PersonName NameNumber="01.01" RPH="1" WithInfant="false">
<Email>YURY.PATRIN#GMAIL.COM</Email>
<GivenName>JAMES</GivenName>
<Surname>GREEN</Surname>
</PersonName>
</CustomerInfo>
<ItineraryInfo>
<ReservationItems>
<Item RPH="1">
<FlightSegment AirMilesFlown="0484" ArrivalDateTime="08-13T08:45" DayOfWeekInd="7" DepartureDateTime="2017-08-13T07:05" ElapsedTime="01.40" FlightNumber="0465" IsPast="false" NumberInParty="01" ResBookDesigCode="Y" SegmentNumber="0001" SmokingAllowed="false" SpecialMeal="false" Status="HK" StopQuantity="00" eTicket="false">
<DestinationLocation LocationCode="HKG" Terminal="TERMINAL 1" TerminalCode="1"/>
<Equipment AirEquipType="773"/>
<MarketingAirline Code="CX" FlightNumber="0465"/>
<Meal Code="B"/>
<OriginLocation LocationCode="TPE" Terminal="TERMINAL 1" TerminalCode="1"/>
<SupplierRef ID="DCCX"/>
<UpdatedArrivalTime>08-13T08:45</UpdatedArrivalTime>
<UpdatedDepartureTime>08-13T07:05</UpdatedDepartureTime>
</FlightSegment>
</Item>
</ReservationItems>
<Ticketing RPH="01" TicketTimeLimit="T-"/>
</ItineraryInfo>
<ItineraryRef AirExtras="false" ID="PGAAHT" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
<Source AAA_PseudoCityCode="4PFI" CreateDateTime="2017-07-11T03:50" CreationAgent="AWS" HomePseudoCityCode="4PFI" LastUpdateDateTime="2017-07-11T03:50" PseudoCityCode="4PFI" ReceivedFrom="TEST" SequenceNumber="1"/>
</ItineraryRef>
<RemarkInfo>
<Remark RPH="001" Type="General">
<Text>TEXT</Text>
</Remark>
</RemarkInfo>
<SpecialServiceInfo RPH="001" Type="GFX">
<Service SSR_Code="SSR" SSR_Type="DOCS">
<Airline Code="CX"/>
<PersonName NameNumber="01.01">GREEN/JAMES</PersonName>
<Text>
HK1/P/FR/1234567890/FR/02DEC1980/M/26MAY2018/GREEN/JAMES/MALCOLM/H
</Text>
</Service>
</SpecialServiceInfo>
</TravelItinerary>
</TravelItineraryReadRS>
</PassengerDetailsRS>
</soap-env:Body>
</soap-env:Envelope>
After this request I recieved booking confirmation on my email. Then, I do DesignatePrinterLLSRQ and TravelItineraryReadRQ.
TravelItineraryReadRQ Request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<MessageHeader xmlns="http://www.ebxml.org/namespaces/messageHeader">
<From>
<PartyId>WebServiceClient</PartyId>
</From>
<To>
<PartyId>WebServiceSupplier</PartyId>
</To>
<CPAId>4PFI</CPAId>
<ConversationId>SWS-Test-4PFI</ConversationId>
<Service>TravelItineraryRead</Service>
<Action>TravelItineraryReadRQ</Action>
<MessageData>
<MessageId>9314594d-6c40-406b-9029-b887b13906b6</MessageId>
<Timestamp>2017-07-11T08:36:19Z</Timestamp>
</MessageData>
</MessageHeader>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
<BinarySecurityToken>
Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!-3255700571383677304!1140614!0
</BinarySecurityToken>
</Security>
</soap:Header>
<soap:Body>
<TravelItineraryReadRQ xmlns="http://services.sabre.com/res/tir/v3_9"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dd="http://webservices.sabre.com/dd2" Version="3.9.0">
<MessagingDetails>
<SubjectAreas>
<SubjectArea>FULL</SubjectArea>
</SubjectAreas>
</MessagingDetails>
<UniqueID ID=""/>
<EchoToken/>
</TravelItineraryReadRQ>
</soap:Body>
</soap:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0"
soap-env:mustUnderstand="1">
<eb:From>
<eb:PartyId eb:type="URI">WebServiceSupplier</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId eb:type="URI">WebServiceClient</eb:PartyId>
</eb:To>
<eb:CPAId>4PFI</eb:CPAId>
<eb:ConversationId>SWS-Test-4PFI</eb:ConversationId>
<eb:Service>TravelItineraryRead</eb:Service>
<eb:Action>TravelItineraryReadRS</eb:Action>
<eb:MessageData>
<eb:MessageId>2506522311129290610</eb:MessageId>
<eb:Timestamp>2017-07-11T08:38:33</eb:Timestamp>
<eb:RefToMessageId>9314594d-6c40-406b-9029-b887b13906b6</eb:RefToMessageId>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">
Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!-3255700571383677304!1140614!0
</wsse:BinarySecurityToken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body>
<tir39:TravelItineraryReadRS xmlns:tir39="http://services.sabre.com/res/tir/v3_9"
xmlns:or8="http://services.sabre.com/res/or/v1_8"
xmlns:stl="http://services.sabre.com/STL/v01"
xmlns:or19="http://services.sabre.com/res/or/v1_9" Version="3.9.0">
<stl:ApplicationResults status="Complete">
<stl:Success timeStamp="2017-07-11T03:38:33.392-05:00"/>
</stl:ApplicationResults>
<tir39:TravelItinerary>
<tir39:CustomerInfo>
<tir39:Address>
<tir39:AddressLine Id="8" type="N">SABRE TRAVEL</tir39:AddressLine>
<tir39:AddressLine Id="9" type="A">3150 SABRE DRIVE</tir39:AddressLine>
<tir39:AddressLine Id="10" type="C">SOUTHLAKE, TX US</tir39:AddressLine>
<tir39:AddressLine Id="11" type="Z">76092</tir39:AddressLine>
</tir39:Address>
<tir39:ContactNumbers>
<tir39:ContactNumber LocationCode="IEV" Phone="817-555-1212-A" RPH="001" Id="7"/>
</tir39:ContactNumbers>
<tir39:PersonName WithInfant="false" NameNumber="01.01" RPH="1" elementId="pnr-4.1">
<tir39:Email Id="6">YURY.PATRIN#GMAIL.COM</tir39:Email>
<tir39:GivenName>JAMES</tir39:GivenName>
<tir39:Surname>GREEN</tir39:Surname>
</tir39:PersonName>
</tir39:CustomerInfo>
<tir39:ItineraryInfo>
<tir39:ReservationItems>
<tir39:Item RPH="1">
<tir39:FlightSegment AirMilesFlown="0484" ArrivalDateTime="08-13T08:45" DayOfWeekInd="7"
DepartureDateTime="2017-08-13T07:05"
SegmentBookedDate="2017-07-11T03:34:00" ElapsedTime="01.40"
eTicket="false" FlightNumber="0465" NumberInParty="01"
ResBookDesigCode="Y" SegmentNumber="0001" SmokingAllowed="false"
SpecialMeal="false" Status="HK" StopQuantity="00" IsPast="false"
CodeShare="false" Id="3">
<tir39:DestinationLocation LocationCode="HKG" Terminal="TERMINAL 1" TerminalCode="1"/>
<tir39:Equipment AirEquipType="773"/>
<tir39:MarketingAirline Code="CX" FlightNumber="0465">
<tir39:Banner>MARKETED BY CATHAY PACIFIC AIRWAYS</tir39:Banner>
</tir39:MarketingAirline>
<tir39:Meal Code="B"/>
<tir39:OperatingAirline Code="CX" FlightNumber="0465" ResBookDesigCode="Y">
<tir39:Banner>OPERATED BY CATHAY PACIFIC AIRWAYS</tir39:Banner>
</tir39:OperatingAirline>
<tir39:OperatingAirlinePricing Code="CX"/>
<tir39:DisclosureCarrier Code="CX" DOT="false">
<tir39:Banner>CATHAY PACIFIC AIRWAYS</tir39:Banner>
</tir39:DisclosureCarrier>
<tir39:OriginLocation LocationCode="TPE" Terminal="TERMINAL 1" TerminalCode="1"/>
<tir39:SupplierRef ID="DCCX"/>
<tir39:UpdatedArrivalTime>08-13T08:45</tir39:UpdatedArrivalTime>
<tir39:UpdatedDepartureTime>08-13T07:05</tir39:UpdatedDepartureTime>
</tir39:FlightSegment>
</tir39:Item>
</tir39:ReservationItems>
<tir39:Ticketing RPH="01" TicketTimeLimit="T-"/>
</tir39:ItineraryInfo>
<tir39:ItineraryRef AirExtras="false" ID="UJUDSY" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
<tir39:Source AAA_PseudoCityCode="4PFI" CreateDateTime="2017-07-11T03:34" CreationAgent="AWS"
HomePseudoCityCode="4PFI" PseudoCityCode="4PFI" ReceivedFrom="TEST"
LastUpdateDateTime="2017-07-11T03:34" SequenceNumber="1"/>
</tir39:ItineraryRef>
<tir39:RemarkInfo>
<tir39:Remark RPH="001" Type="General" Id="14">
<tir39:Text>TEXT</tir39:Text>
</tir39:Remark>
</tir39:RemarkInfo>
<tir39:SpecialServiceInfo RPH="001" Type="GFX" Id="12">
<tir39:Service SSR_Code="SSR" SSR_Type="DOCS">
<tir39:Airline Code="CX"/>
<tir39:PersonName NameNumber="01.01">GREEN/JAMES</tir39:PersonName>
<tir39:Text>
HK1/P/FR/1234567890/FR/02DEC1980/M/26MAY2018/GREEN/JAMES/MALCOLM/H
</tir39:Text>
</tir39:Service>
</tir39:SpecialServiceInfo>
<tir39:SpecialServiceInfo RPH="002" Type="GFX" Id="13">
<tir39:Service SSR_Code="SSR" SSR_Type="DOCS">
<tir39:Airline Code="CX"/>
<tir39:PersonName NameNumber="01.01">GREEN/JAMES</tir39:PersonName>
<tir39:Text>HK1/DB/02DEC1980/M/GREEN/JAMES</tir39:Text>
</tir39:Service>
</tir39:SpecialServiceInfo>
</tir39:TravelItinerary>
</tir39:TravelItineraryReadRS>
</soap-env:Body>
</soap-env:Envelope>
And then I do AirTicketLLSRQ.
Request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<MessageHeader xmlns="http://www.ebxml.org/namespaces/messageHeader">
<From>
<PartyId>WebServiceClient</PartyId>
</From>
<To>
<PartyId>WebServiceSupplier</PartyId>
</To>
<CPAId>4PFI</CPAId>
<ConversationId>SWS-Test-4PFI</ConversationId>
<Service>AirTicketRQ</Service>
<Action>AirTicketLLSRQ</Action>
<MessageData>
<MessageId>9314594d-6c40-406b-9029-b887b13906b6</MessageId>
<Timestamp>2017-07-11T08:39:43Z</Timestamp>
</MessageData>
</MessageHeader>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
<BinarySecurityToken>
Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!-3255700571383677304!1140614!0
</BinarySecurityToken>
</Security>
</soap:Header>
<soap:Body>
<AirTicketRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" NumResponses="1" Version="2.10.0"
ReturnHostCommand="true">
<OptionalQualifiers>
<FlightQualifiers>
<VendorPrefs>
<Airline Code="CX"/>
</VendorPrefs>
</FlightQualifiers>
<MiscQualifiers>
<Ticket Type="ETR"/>
</MiscQualifiers>
<PricingQualifiers>
<PriceQuote>
<Record Number="1"/>
</PriceQuote>
</PricingQualifiers>
</OptionalQualifiers>
</AirTicketRQ>
</soap:Body>
</soap:Envelope>
Response:
<?xml version="1.0" encoding="utf-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0"
soap-env:mustUnderstand="1">
<eb:From>
<eb:PartyId eb:type="URI">WebServiceSupplier</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId eb:type="URI">WebServiceClient</eb:PartyId>
</eb:To>
<eb:CPAId>4PFI</eb:CPAId>
<eb:ConversationId>SWS-Test-4PFI</eb:ConversationId>
<eb:Service>AirTicketRQ</eb:Service>
<eb:Action>AirTicketLLSRS</eb:Action>
<eb:MessageData>
<eb:MessageId>393675312556970611</eb:MessageId>
<eb:Timestamp>2017-07-11T08:40:56</eb:Timestamp>
<eb:RefToMessageId>9314594d-6c40-406b-9029-b887b13906b6</eb:RefToMessageId>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">
Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/CERTG!ICESMSLB\/CRT.LB!-3255700571383677304!1140614!0
</wsse:BinarySecurityToken>
</wsse:Security>
</soap-env:Header>
<soap-env:Body>
<AirTicketRS xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stl="http://services.sabre.com/STL/v01"
Version="2.10.0">
<stl:ApplicationResults status="NotProcessed">
<stl:Error type="BusinessLogic" timeStamp="2017-07-11T03:40:56-05:00">
<stl:SystemSpecificResults>
<stl:HostCommand LNIATA="757110">W¥PQ1¥ETR¥ACX</stl:HostCommand>
<stl:Message>PNR HAS BEEN UPDATED-IGN AND RETRY-0049</stl:Message>
<stl:ShortText>ERR.SWS.HOST.ERROR_IN_RESPONSE</stl:ShortText>
</stl:SystemSpecificResults>
</stl:Error>
</stl:ApplicationResults>
</AirTicketRS>
</soap-env:Body>
</soap-env:Envelope>
How can I fix this error? Maybe I am doing something wrong?
What you encountered is quite a normal situation (but unwanted).
Solution to this is to run (but only after you detect PNR HAS BEEN UPDATED-IGN AND RETRY error)
ignore command
rerun AirTicketRQ (exactly the same that failed in the first run)
As far as Ignore command is concerned what you should know is that it will ignore (cancel) all your PNR changes since the last successful EndTransactionRQ, so it's best to have everything saved before AirTicketRQ is expected to be run
Example of ignore command (IR in HostCommand will trigger ignore transaction) :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns4:MessageHeader xmlns:ns8="http://www.w3.org/2000/09/xmldsig#" xmlns:ns7="http://www.opentravel.org/OTA/2002/11" xmlns:ns6="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ns5="http://www.w3.org/1999/xlink" xmlns:ns4="http://www.ebxml.org/namespaces/messageHeader">
<ns4:ConversationId> CONVERSATION_ID </ns4:ConversationId>
<ns4:From>
<ns4:PartyId ns4:type="urn:x12.org:IO5:01"> PARTY_ID_FROM </ns4:PartyId>
<ns4:Role></ns4:Role>
</ns4:From>
<ns4:To>
<ns4:PartyId ns4:type="urn:x12.org:IO5:01"> PARTY_ID_TO </ns4:PartyId>
<ns4:Role></ns4:Role>
</ns4:To>
<ns4:CPAId>GF</ns4:CPAId>
<ns4:Service ns4:type="OTA"></ns4:Service>
<ns4:Action>SabreCommandLLSRQ</ns4:Action>
</ns4:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary"> BOOKING_PROVIDER_SESSION </wsse:BinarySecurityToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<SabreCommandLLSRQ xmlns="http://webservices.sabre.com/sabreXML/2003/07" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TimeStamp="2014-03-04T14:00:00" Version="1.8.1">
<Request Output="SCREEN" CDATA="true">
<HostCommand>IR</HostCommand>
</Request>
</SabreCommandLLSRQ>
</soap:Body>
</soap:Envelope>
Sabre is launching a new Orchestrated AirTicketRQ service that will automate and simplify many of these items, and much much more magic. If you are interested, please let us know...
I have developed a service in top down approach and it is working fine using apache cxf. Now I am trying to add basic authentication to the service. I have configured the server call back handler and spring bean (cxf-servlet.xml) as per the apache cxf documentation. But still
I am getting below error executing a soap request on SOAP UI.
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Timestamp wsu:Id="TS-14"><wsu:Created>2017-01-20T13:54:07Z</wsu:Created><wsu:Expires>2017-01-20T14:27:27Z</wsu:Expires></wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-13">
<wsse:Username>username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">vPFjyEznvPB8HkWDOoL7dw==</wsse:Nonce>
<wsu:Created>2017-01-20T13:54:07.244Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
Below is the my servercallback handler part.
<bean id="myPasswordCallback"
class="com.firstbest.webservice.ofacimpl.ServerPasswordCallback" />
<jaxws:endpoint publish="true" id="ofacid"
implementor="com.firstbest.webservice.ofacimpl.OfacInquirySearchImpl"
address="/PerformOFACValidationWS">
<jaxws:inInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken" />
<entry key="passwordType" value="PasswordText" />
<entry key="passwordCallbackRef">
<ref bean="myPasswordCallback" />
</entry>
</map>
</constructor-arg>
</bean>
</jaxws:inInterceptors>
</jaxws:endpoint>
I have tried different solution regarding this on net. But couldn't help me much.
Below is the error:-
WARNING: Interceptor for
{http://sdawweaid1.gc.win-na.com/QBE_OFAC/Producer/BridgerInsight/WS/executeIService_SearchWS}OfacInquirySearchImplService#{http://sdawweaid1.gc.win-na.com/QBE_OFAC/Producer/BridgerInsight/WS/executeIService_SearchWS}executeIService_Search
has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: A security error was
encountered when verifying the message at
org.apache.cxf.ws.security.wss4j.WSS4JUtils.createSoapFault(WSS4JUtils.java:233)
at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessageInternal(WSS4JInInterceptor.java:317)
at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:171)
at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:80)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:252)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:218)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326) at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.apache.wss4j.common.ext.WSSecurityException: An error
was discovered processing the header at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:361)
at
org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessageInternal(WSS4JInIntercept
I am trying to configure WSS4JInInterceptor in my cxf endpoint through camel-config.xml
Below is my camel-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: e1 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<!-- spring property placeholder, ignore resource not found as the file resource is for unit testing -->
<context:property-placeholder location="classpath:incident.properties,file:target/custom.properties"
ignore-resource-not-found="true"/>
<!-- bean that enriches the SOAP request -->
<bean id="enrichBean" class="org.apache.camel.example.cxf.proxy.EnrichBean"/>
<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
<bean id="wss4jInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<property name="properties">
<map>
<entry key="action" value="UsernameToken Timestamp"/>
<entry key="passwordType" value="PasswordDigest"/>
<entry key="ws-security.is-bsp-compliant" value="false"/>
<entry key="passwordCallbackClass" value="org.apache.camel.example.cxf.proxy.UTPasswordCallback"/>
</map>
</property>
</bean>
<!-- this is the CXF web service we use as the front end -->
<cxf:cxfEndpoint id="versionService"
address="http://localhost:${proxy.port}/camel-example-cxf-proxy/webservices/versionAdapter"
endpointName="s:VersionHttpSoap11Endpoint"
serviceName="s:Version"
wsdlURL="etc/versionAdapter.wsdl"
xmlns:s="http://axisversion.sample">
<cxf:inInterceptors>
<ref bean="loggingInInterceptor"/>
<ref bean="wss4jInInterceptor"/>
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="loggingOutInterceptor"/>
</cxf:outInterceptors>
</cxf:cxfEndpoint>
<!-- this is the Camel route which proxies the real web service and forwards SOAP requests to it -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- property which contains port number -->
<propertyPlaceholder id="properties" location="classpath:incident.properties,file:target/custom.properties"/>
<endpoint id="callRealWebService" uri="http://localhost:${real.port}/axis2/services/Version?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
<route>
<!-- CXF consumer using MESSAGE format -->
<from uri="cxf:bean:versionService?dataFormat=MESSAGE"/>
<!-- log input received -->
<to uri="log:input"/>
<!-- enrich the input by ensure the incidentId parameter is set -->
<to uri="bean:enrichBean"/>
<!-- opp removing headers... testing -->
<removeHeaders pattern="*" />
<!-- send proxied request to real web service -->
<to uri="callRealWebService"/>
<!-- log answer from real web service -->
<to uri="log:output"/>
</route>
</camelContext>
</beans>
<!-- END SNIPPET: e1 -->
When i invoke my proxy webservice i am getting error. Here is the complete error trace..
INFO: Inbound Message
----------------------------
ID: 1
Address: http://localhost:9080/camel-example-cxf-proxy/webservices/versionAdapter
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml;charset=UTF-8
Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Length=[1097], content-type=[text/xml;charset
=UTF-8], Host=[localhost:9080], SOAPAction=["urn:getVersion"], User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]}
Payload: <soapenv:Envelope xmlns:axis="http://axisversion.sample" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop
e/">
<soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-20
0401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit
y-1.0.xsd"><wsu:Timestamp wsu:Id="TS-42"><wsu:Created>2014-11-19T12:41:10Z</wsu:Created><wsu:Expires>2014-11-19T13:14:30
Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken wsu:Id="UsernameToken-41"><wsse:Username>opp</wsse:Username><wsse:Pas
sword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">m0c8nW1n+
/jfHzwM5lHc9F3+B1g=</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soa
p-message-security-1.0#Base64Binary">VUr9FAuf1J/UYWEBMdTAlA==</wsse:Nonce><wsu:Created>2014-11-19T12:41:10.455Z</wsu:Cre
ated></wsse:UsernameToken></wsse:Security></soapenv:Header>
<soapenv:Body>
<axis:getVersion/>
</soapenv:Body>
</soapenv:Envelope>
--------------------------------------
Inside UTPasswordCallback Method # UTPasswordCallback class
Wed Nov 19 18:10:33 IST 2014 Inside UTPasswordCallback()--> UTPasswordCallback Class
Nov 19, 2014 6:10:33 PM org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor checkActions
WARNING: Security processing failed (actions mismatch)
Nov 19, 2014 6:10:33 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://axisversion.sample}Version has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: An error was discovered processing the <wsse:Security> header.
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.createSoapFault(WSS4JInInterceptor.java:809)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:313)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:93)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.wss4j.common.ext.WSSecurityException: An error was discovered processing the <wsse:Security> heade
r
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:339)
at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:297)
... 23 more
I am unable to figure out what this error is all about and how can i rectify this error?
Please help on this..
Please use CXF_MESSAGE data format instead of MESSAGE data format.
Environment :
Apache CXF 2.7.8
Jboss EAP 6
SoapUI for testing client Side
I tried to implement for simple authentication i.e with password simple text type, it is working but when i tried to implement for password digest type ,then giving me exception:
unwinding now: org.apache.cxf.binding.soap.SoapFault: The message has
expired org.apache.ws.security.WSSecurityException: The message has
expired
I am giving new nonce value for each request and time within five min diff
WSS4JInInterceptor Bean class defination:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint id="orderProcess" implementor="demo.order.OrderProcessImpl" address="/OrderProcess" >
<jaxws:inInterceptors>
<bean
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken"/>
<entry key="passwordType" value="PasswordDigest"/>
<entry key="passwordCallbackRef" value-ref="myPasswordCallback"/>
</map>
</constructor-arg>
</bean>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean id="myPasswordCallback" class="service.ServerPasswordCallback" />
</beans>
Client xml request Code:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ord="http://order.demo/"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soapenv:Header>
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>joe</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">PE7F51/oyWFVMsiZURuUwjoZVPY=</wsse:Password>
<!--<wsu:Created>2013-12-17T13:12:00.429Z</wsu:Created>-->
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">efPSkfHXTM6NFDDD1CJHsw==</wsse:Nonce>
<wsu:Created>2013-12-23T12:17:15Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ord:processOrder>
<!--Optional:-->
<arg0>
<!--Optional:-->
<customerID>234</customerID>
<!--Optional:-->
<itemID>0908923</itemID>
<price>23423</price>
<qty>1000</qty>
</arg0>
</ord:processOrder>
</soapenv:Body>
</soapenv:Envelope>
When i tried to call the service i am getting exception as
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">ns1:MessageExpired</faultcode>
<faultstring>The message has expired</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Can any one tell me where i am making mistake?
I suspect this is a bug in earlier version of wss4j. If you are parsing the date using SimpleDateFormat, you might want to set the time zone to UTC (Zulu time).
sdf.setTimeZone("UTC");
This however has been fixed in 2.0-beta.
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.wss4j/wss4j-ws-security-dom/2.0-beta/org/apache/wss4j/dom/message/token/UsernameToken.java#226
Edit: This is not a bug in wss4j. The specification states that the time zone must be in UTC.