コード例 #1
0
 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());
 }
コード例 #2
0
  /**
   * This method does the work of creating an instance of the class given the URL of the wsdl
   * provided in the constructor. This is actually type-safe, so the fact that "abort" if anything
   * goes wrong should never happen.
   */
  protected void init() {
    try {
      URL url = WSDLService.getURLForWSDL(wsdl);
      Constructor<S> constructor = clazzS.getConstructor(URL.class);
      service = constructor.newInstance(url);

    } catch (SecurityException e) {
      throw new RuntimeException(
          "You supplied a bad *service*/port pair (Security):" + e.getMessage());
    } catch (NoSuchMethodException e) {
      throw new RuntimeException(
          "You supplied a bad *service*/port pair (NoSuchMethod):" + e.getMessage());
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(
          "You supplied a bad *service*/port pair (IllegalArgument):" + e.getMessage());
    } catch (IllegalAccessException e) {
      throw new RuntimeException(
          "You supplied a bad *service*/port pair (IllegalAccess):" + e.getMessage());
    } catch (InvocationTargetException e) {
      throw new RuntimeException(
          "You supplied a bad *service*/port pair (InvocationTarget):" + e.getMessage());
    } catch (InstantiationException e) {
      throw new RuntimeException(
          "You supplied a bad *service*/port pair (Instantiation):" + e.getMessage());
    }
  }