/**
  * Tests client-side access to EPR extensions specified in WSDL
  *
  * @throws Exception
  */
 public void testEprWithDispatchWithoutWSDL() throws Exception {
   Service service = Service.create(serviceName);
   service.addPort(portName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
   Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
   WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
   assertTrue(wsepr.getEPRExtensions().isEmpty());
 }
 /**
  * Tests client-side access to EPR extensions specified in WSDL
  *
  * @throws Exception
  */
 public void testEprWithDispatchWithWSDL() throws Exception {
   Service service = new HelloService();
   Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
   WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
   assertTrue(wsepr.getEPRExtensions().size() == 2);
   WSEndpointReference.EPRExtension idExtn =
       wsepr.getEPRExtension(new QName("http://example.com/addressingidentity", "Identity"));
   assertTrue(
       idExtn != null
           && idExtn
               .getQName()
               .equals(new QName("http://example.com/addressingidentity", "Identity")));
 }
 /**
  * Tests the published wsdl for EPR extensions
  *
  * @throws Exception
  */
 public void testEprInPublishedWSDL() throws Exception {
   HelloService service = new HelloService();
   Hello hello = service.getHelloPort();
   WSDLPort wsdlModel = ((WSBindingProvider) hello).getPortInfo().getPort();
   WSEndpointReference wsdlepr = wsdlModel.getExtension(WSEndpointReference.class);
   assertTrue(wsdlepr.getEPRExtensions().size() == 2);
   WSEndpointReference.EPRExtension idExtn =
       wsdlepr.getEPRExtension(new QName("http://example.com/addressingidentity", "Identity"));
   assertTrue(
       idExtn != null
           && idExtn
               .getQName()
               .equals(new QName("http://example.com/addressingidentity", "Identity")));
 }
 public void test1() throws Exception {
   URL fileurl = getResource("hello_literal_identity.wsdl");
   WSDLModel doc =
       RuntimeWSDLParser.parse(
           fileurl, new StreamSource(fileurl.toExternalForm()), getResolver(), true, null);
   WSDLService service = doc.getService(new QName("urn:test", "Hello"));
   WSDLPort port = service.getFirstPort();
   WSEndpointReference wsepr = port.getExtension(WSEndpointReference.class);
   QName q = new QName("http://schemas.xmlsoap.org/ws/2006/02/addressingidentity", "Identity");
   WSEndpointReference.EPRExtension eprExtn = wsepr.getEPRExtension(q);
   XMLStreamReader xsr = eprExtn.readAsXMLStreamReader();
   if (xsr.getEventType() == XMLStreamConstants.START_DOCUMENT) xsr.next();
   assertEquals(q.getNamespaceURI(), xsr.getNamespaceURI());
   assertEquals(q.getLocalPart(), xsr.getLocalName());
 }
  /**
   * Tests server-side access to EPR extensions specified in WSDL
   *
   * @throws Exception
   */
  public void testEprOnServerSide() throws Exception {
    HelloService service = new HelloService();
    Hello hello = service.getHelloPort();
    W3CEndpointReference serverEpr = hello.getW3CEPR();
    //  printEPR(serverEpr);

    WSEndpointReference wsepr = new WSEndpointReference(serverEpr);
    assertTrue(wsepr.getEPRExtensions().size() == 2);
    WSEndpointReference.EPRExtension idExtn =
        wsepr.getEPRExtension(new QName("http://example.com/addressingidentity", "Identity"));
    assertTrue(
        idExtn != null
            && idExtn
                .getQName()
                .equals(new QName("http://example.com/addressingidentity", "Identity")));
  }