use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WSEndpointReferenceTest method testCreateViaSpec.
public void testCreateViaSpec() throws Exception {
W3CEndpointReference spec = new W3CEndpointReference(new StreamSource(getClass().getResource("test-epr.xml").toExternalForm()));
new WSEndpointReference(spec, W3C);
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WSEndpointReferenceTest method testCreateViaBuffer.
public void testCreateViaBuffer() throws Exception {
WSEndpointReference epr = createEPR();
System.out.println(epr.toString());
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WSEndpointReferenceTest method creaateSubtreeEPR.
/**
* This creates {@link WSEndpointReference} that uses a fragment infoset.
* We should really fix this in XMLStreamBuffer.
*/
private WSEndpointReference creaateSubtreeEPR() throws XMLStreamException {
XMLStreamBuffer xsb = XMLStreamBuffer.createNewBufferFromXMLStreamReader(XMLInputFactory.newInstance().createXMLStreamReader(getClass().getResourceAsStream("test-epr.xml")));
StreamReaderBufferProcessor p = xsb.readAsXMLStreamReader();
XMLStreamBuffer mark = p.nextTagAndMark();
return new WSEndpointReference(mark, W3C);
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WSEndpointReferenceTest method testAddress.
public void testAddress() throws Exception {
WSEndpointReference epr = createEPR();
assertEquals("http://example.com/fabrikam/acct", epr.getAddress());
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WSAM_EPRTester method runOptionalEPRTests.
private void runOptionalEPRTests() throws Exception {
URL res = getClass().getClassLoader().getResource("epr/wsamTest.wsdl");
// assuming that this is a file:// URL.
File folder = new File(new File(res.getFile()).getParentFile(), "optional");
System.out.println("\n\nOptional Tests:\n");
for (File f : folder.listFiles()) {
if (!f.getName().endsWith(".xml"))
continue;
System.out.println("***************************");
System.out.println("TestFile: " + f.getParentFile().getName() + "/" + f.getName());
try {
InputStream is = new FileInputStream(f);
StreamSource s = new StreamSource(is);
EndpointReference epr = EndpointReference.readFrom(s);
WSEndpointReference wsepr = new WSEndpointReference(epr);
System.out.println("Address: " + wsepr.getAddress());
WSEndpointReference.Metadata metadata = wsepr.getMetaData();
System.out.println("Metadata Valid?: true");
if (metadata.getPortTypeName() != null)
System.out.println("InterfaceName: " + metadata.getPortTypeName());
if (metadata.getServiceName() != null)
System.out.println("ServiceName: " + metadata.getServiceName());
if (metadata.getPortName() != null)
System.out.println("Endpoint: " + metadata.getPortName().getLocalPart());
String wsdliLocation = metadata.getWsdliLocation();
if (metadata.getWsdliLocation() != null) {
System.out.println("wsdli:wsdlLocation: " + wsdliLocation);
String wsdlLocation = wsdliLocation.substring(wsdliLocation.lastIndexOf(" "));
WSDLModel wsdlModel = RuntimeWSDLParser.parse(new URL(wsdlLocation), new StreamSource(wsdlLocation), XmlUtil.createDefaultCatalogResolver(), false, Container.NONE, ServiceFinder.find(WSDLParserExtension.class).toArray());
QName binding = wsdlModel.getBinding(metadata.getServiceName(), metadata.getPortName()).getName();
System.out.println("Binding from WSDL: " + binding);
}
System.out.println("");
} catch (Exception e) {
System.out.println("Metadata Valid?: false");
System.out.println("Reason: " + e.getMessage());
// e.printStackTrace();
System.out.println("");
}
}
}
Aggregations