Solved. I just needed to use the OneWayFeature

import com.sun.xml.internal.ws.api.addressing.AddressingVersion
import com.sun.xml.internal.ws.api.addressing.OneWayFeature
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference
@Grapes([
  @Grab(group = 'com.github.rahulsom', module = 'ihe-iti', version = '0.3'),
  @Grab(group = 'org.apache.cxf', module = 'cxf-rt-ws-addr', version = '2.6.7'),
])

import ihe.iti.xds_b._2007.RespondingGatewayQueryService
import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest
import oasis.names.tc.ebxml_regrep.xsd.query._3.ResponseOptionType
import oasis.names.tc.ebxml_regrep.xsd.rim._3.AdhocQueryType
import oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1
import oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType

import javax.xml.ws.BindingProvider
import javax.xml.ws.soap.AddressingFeature

RespondingGatewayQueryService theService = new 
RespondingGatewayQueryService(new 
URL('http://localhost:8080/healthdock/alpine/xca-r-query?wsdl'))

def thePort = theService.getRespondingGatewayQueryPortSoap12(
    new AddressingFeature(true, true),
    new OneWayFeature(
        true,
        new WSEndpointReference('http://localhost:9000/dec', 
AddressingVersion.W3C),
        new WSEndpointReference('urn:oid:1.2.3.4', AddressingVersion.W3C),
        'something'
    )
)
def bp = thePort as BindingProvider

bp.requestContext[BindingProvider.ENDPOINT_ADDRESS_PROPERTY] = 
'http://localhost:8080/healthdock/alpine/xca-r-query'

def query =
  new AdhocQueryRequest().withAdhocQuery(
      new AdhocQueryType()
          .withId('urn:uuid:14d4debf-8f97-4251-9a74-a90016b0af0d')
          .withSlot(
          new SlotType1()
              .withName('$XDSDocumentEntryPatientId')
              .withValueList(new 
ValueListType().withValue('123^^^&1.2.3.4&ISO')),
          new SlotType1()
              .withName('$XDSDocumentEntryStatus')
              .withValueList(new 
ValueListType().withValue('urn:oasis:names:tc:ebxml-regrep:StatusType:Approved'))
      )
  ).withResponseOption(
      new ResponseOptionType()
          .withReturnType('LeafClass')
          .withReturnComposedObjects(true)
  )

thePort.respondingGatewayCrossGatewayQuery(query)

On Dec 2, 2013, at 2:55 PM, Rahul Somasunderam <[email protected]> 
wrote:

> Hi,
> 
> I'm trying to set the ReplyTo header in my soap request. This is my code. It 
> doesn't seem to set the header correctly.
> 
> @Grapes([
>  @Grab(group = 'com.github.rahulsom', module = 'ihe-iti', version = '0.3'),
>  @Grab(group = 'org.apache.cxf', module = 'cxf-rt-ws-addr', version = 
> '2.6.7'),
> ])
> 
> import ihe.iti.xds_b._2007.RespondingGatewayQueryService
> import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest
> import oasis.names.tc.ebxml_regrep.xsd.query._3.ResponseOptionType
> import oasis.names.tc.ebxml_regrep.xsd.rim._3.AdhocQueryType
> import oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1
> import oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType
> import org.apache.cxf.ws.addressing.WSAContextUtils
> 
> import javax.xml.ws.BindingProvider
> import javax.xml.ws.soap.AddressingFeature
> 
> RespondingGatewayQueryService theService = new 
> RespondingGatewayQueryService(new 
> URL('http://localhost:8080/healthdock/alpine/xca-r-query?wsdl'))
> 
> def thePort = theService.getRespondingGatewayQueryPortSoap12(new 
> AddressingFeature(true, true))
> BindingProvider bp = thePort
> bp.requestContext[BindingProvider.ENDPOINT_ADDRESS_PROPERTY] = 
> 'http://localhost:8080/healthdock/alpine/xca-r-query'
> bp.requestContext[WSAContextUtils.REPLYTO_PROPERTY] = 
> 'http://localhost:9090/decoupled_endpoint'
> 
> def query = new AdhocQueryRequest()
>    .withAdhocQuery(new AdhocQueryType()
>        .withId('123')
>        .withSlot(
>            new SlotType1(name: '$XDSDocumentEntryPatientId', valueList: new 
> ValueListType(value: ['123^^^&1.2.3.4&ISO'])),
>            new SlotType1(
>                name: '$XDSDocumentEntryStatus',
>                valueList: new ValueListType(value: [
>                    'urn:oasis:names:tc:ebxml-regrep:StatusType:Approved',
>                ]))
>        )
> 
>    )
>    .withResponseOption(new ResponseOptionType()
>        .withReturnType('LeafClass')
>        .withReturnComposedObjects(true)
>    )
> 
> thePort.respondingGatewayCrossGatewayQuery(query)
> This is what I receive at the server
> 
> ID: 7
> Address: http://localhost:8080/healthdock/services/receivingGatewayQuery
> Encoding: UTF-8
> Http-Method: POST
> Content-Type: application/soap+xml; 
> charset=utf-8;action="urn:ihe:iti:2007:CrossGatewayQuery"
> Headers: {Accept=[application/soap+xml, multipart/related], 
> connection=[keep-alive], Content-Length=[1440], 
> content-type=[application/soap+xml; 
> charset=utf-8;action="urn:ihe:iti:2007:CrossGatewayQuery"], 
> host=[localhost:8080], user-agent=[JAX-WS RI 2.2.4-b01]}
> Payload: <?xml version='1.0' encoding='UTF-8'?><S:Envelope 
> xmlns:S="http://www.w3.org/2003/05/soap-envelope";><S:Header><To 
> xmlns="http://www.w3.org/2005/08/addressing";>http://localhost:8080/healthdock/alpine/xca-r-query</To><Action
>  xmlns="http://www.w3.org/2005/08/addressing"; 
> xmlns:S="http://www.w3.org/2003/05/soap-envelope"; 
> S:mustUnderstand="true">urn:ihe:iti:2007:CrossGatewayQuery</Action><ReplyTo 
> xmlns="http://www.w3.org/2005/08/addressing";>
>    <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
> </ReplyTo><MessageID 
> xmlns="http://www.w3.org/2005/08/addressing";>uuid:cd66b8bb-ce01-4ec0-98ff-fa03c368619a</MessageID></S:Header><S:Body><ns6:AdhocQueryRequest
>  xmlns:ns2="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" 
> xmlns:ns3="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" 
> xmlns:ns4="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" 
> xmlns:ns5="urn:ihe:iti:xds-b:2007" 
> xmlns:ns6="urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0" 
> xmlns:ns7="urn:oasis:names:tc:ebxml-regrep:xsd:cms:3.0"><ns6:ResponseOption 
> returnType="LeafClass" returnComposedObjects="true"/><ns2:AdhocQuery 
> id="123"><ns2:Slot 
> name="$XDSDocumentEntryPatientId"><ns2:ValueList><ns2:Value>123^^^&amp;1.2.3.4&amp;ISO</ns2:Value></ns2:ValueList></ns2:Slot><ns2:Slot
>  
> name="$XDSDocumentEntryStatus"><ns2:ValueList><ns2:Value>urn:oasis:names:tc:ebxml-regrep:StatusType:Approved</ns2:Value></ns2:ValueList></ns2:Slot></ns2:AdhocQuery></ns6:AdhocQueryRequest></S:Body></S:Envelope>
> Any hints as to what I'm doing wrong? Oh, and my code is in groovy.
> 
> R,
> 
> rahul

Reply via email to