コード例 #1
0
  /**
   * Convert from EndpointReference to CXF internal 2005/08 EndpointReferenceType
   *
   * @param external the javax.xml.ws.EndpointReference
   * @return CXF internal 2005/08 EndpointReferenceType
   */
  public static EndpointReferenceType convertToInternal(EndpointReference external) {
    if (external instanceof W3CEndpointReference) {

      try {
        Document doc = XMLUtils.newDocument();
        DOMResult result = new DOMResult(doc);
        external.writeTo(result);
        W3CDOMStreamReader reader = new W3CDOMStreamReader(doc.getDocumentElement());

        // CXF internal 2005/08 EndpointReferenceType should be
        // compatible with W3CEndpointReference
        // jaxContext = ContextUtils.getJAXBContext();
        JAXBContext context =
            JAXBContext.newInstance(new Class[] {org.apache.cxf.ws.addressing.ObjectFactory.class});
        EndpointReferenceType internal =
            context.createUnmarshaller().unmarshal(reader, EndpointReferenceType.class).getValue();
        return internal;
      } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (ParserConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      return null;
    } else {
      // TODO: 200408
    }
    return null;
  }