QName validPortQName = new QName(namespaceURI, "EchoPortAdded");
service.addPort(validPortQName, null, null);
Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
assertNotNull(dispatch);
BindingProvider bindingProvider = (BindingProvider) dispatch;
ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
assertNotNull(serviceDelegate);
EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
assertNotNull(endpointDesc);
AxisService axisService = endpointDesc.getAxisService();
assertNotNull(axisService);
// The endpoint address should be null since it wasn't specified on the addPort
String endpointAddress = endpointDesc.getEndpointAddress();
assertNull(endpointAddress);
QName validPortQName2 = new QName(namespaceURI, "EchoPortAdded2");
final String port2EndpointAddress = "http://testAddress:6060/my/test/address";
service.addPort(validPortQName2, null, port2EndpointAddress);
dispatch = service.createDispatch(validPortQName2, String.class, null);
assertNotNull(dispatch);
bindingProvider = (BindingProvider) dispatch;
endpointDesc = bindingProvider.getEndpointDescription();
assertNotNull(endpointDesc);
// The endpoint address should be as set on the addPort above.
endpointAddress = endpointDesc.getEndpointAddress();
assertEquals(port2EndpointAddress, endpointAddress);
}