try {
element.addChild(createElement(inSeqXML));
} catch (XMLStreamException e) {
String msg = "Unable to build the \"inSequence\" element";
log.error(msg + e.getMessage());
throw new ProxyAdminException(msg, e);
}
}
if (outSeqKey != null) {
element.addAttribute("outSequence", outSeqKey, nullNS);
} else if (outSeqXML != null) {
try {
element.addChild(createElement(outSeqXML));
} catch (XMLStreamException e) {
String msg = "Unable to build the \"outSequence\" element";
log.error(msg + e.getMessage());
throw new ProxyAdminException(msg, e);
}
}
if (faultSeqKey != null) {
element.addAttribute("faultSequence", faultSeqKey, nullNS);
} else if (faultSeqXML != null) {
try {
element.addChild(createElement(faultSeqXML));
} catch (XMLStreamException e) {
String msg = "Unable to build the \"faultSequence\" element";
log.error(msg + e.getMessage());
throw new ProxyAdminException(msg, e);
}
}
if (endpointKey != null) {
element.addAttribute("endpoint", endpointKey, nullNS);
} else if (endpointXML != null && !"".equals(endpointXML)) {
try {
element.addChild(createElement(endpointXML));
} catch (XMLStreamException e) {
String msg = "Unable to build the \"endpoint\" element";
log.error(msg + e.getMessage());
throw new ProxyAdminException(msg, e);
}
}
proxy.addChild(element);
// creates the publishWSDL section of the configuration
element = fac.createOMElement("publishWSDL", syn);
if (wsdlKey != null) {
publishWSDL = true;
element.addAttribute("key", wsdlKey, nullNS);
} else if (wsdlURI != null) {
publishWSDL = true;
element.addAttribute("uri", wsdlURI, nullNS);
} else if (wsdlDef != null) {
publishWSDL = true;
try {
element.addChild(createElement(wsdlDef));
} catch (XMLStreamException e) {
String msg = "Unable to build the in line WSDL definition";
log.error(msg + e.getMessage());
throw new ProxyAdminException(msg, e);
}
}
if (publishWSDL){
// builds the additional resources (if any) required by the WSDL
if (wsdlResources != null && wsdlResources.length != 0) {
OMElement resource;
Entry wsdlResource;
for (int i = 0; i < wsdlResources.length; i++) {
wsdlResource = wsdlResources[i];
resource = fac.createOMElement("resource", syn);
resource.addAttribute("location", wsdlResource.getKey(), nullNS);
resource.addAttribute("key", wsdlResource.getValue(), nullNS);
element.addChild(resource);
}
}
proxy.addChild(element);
}
// creates the additional service level parameter list of the configuration
if (serviceParams != null && serviceParams.length != 0) {
Entry serviceParam;
String value;
for (int i = 0; i < serviceParams.length; i++) {
serviceParam = serviceParams[i];
element = fac.createOMElement("parameter", syn);
element.addAttribute("name", serviceParam.getKey(), nullNS);
value = serviceParam.getValue();
if (value.startsWith("<")) {
try {
element.addChild(new StAXOMBuilder(
new ByteArrayInputStream(value.getBytes())).getDocumentElement());
} catch (XMLStreamException e) {
String msg = "Service parameter: " + serviceParam.getKey() + " has an invalid XML as its value";
log.error(msg);
throw new ProxyAdminException(msg,e);
}
} else {
element.setText(value);
}
proxy.addChild(element);