Fixed issue with SOAP namespace and REST paths

This commit is contained in:
Ziver Koc 2021-03-02 21:09:30 +01:00
parent fd7f197a17
commit 4c9e6252e9
3 changed files with 17 additions and 10 deletions

View file

@ -108,8 +108,8 @@ public class WSMethodDef {
else
path = name;
if (path.startsWith("/"))
path = path.substring(1);
if (!path.startsWith("/"))
path = '/' + path;
// ------------------------------------------------
// Handle inputs
@ -191,10 +191,17 @@ public class WSMethodDef {
}
/**
* @return the path to the WS method endpoint
* @return the relative path to the WS method endpoint
*/
public String getPath() {
return wsDef.getPath() + "/" + path;
return path;
}
/**
* @return the path to the WS method endpoint
*/
public String getAbsolutePath() {
return wsDef.getPath() + path;
}
/**

View file

@ -291,7 +291,7 @@ public class SOAPHttpPage implements HttpPage{
// generate response XML
if (outputParamDefs.size() > 0) {
Element response = responseRoot.addElement("");
response.addNamespace("m", methodDef.getPath() );
response.addNamespace("m", methodDef.getAbsolutePath() );
response.setName("m:" + methodDef.getName() + "Response");
if (outputParams instanceof WSReturnObject) {
@ -307,7 +307,7 @@ public class SOAPHttpPage implements HttpPage{
}
}
else {
throw new NoSuchMethodException("Unable to find method: "+e.getQName().getName()+"!");
throw new NoSuchMethodException("Unable to find method: " + e.getQName().getName() + "!");
}
}
}

View file

@ -28,7 +28,7 @@ import org.dom4j.Element;
import zutil.net.ws.WSMethodDef;
/**
* User: Ziver
* A SOAP service generator for WSDL specification
*/
public class WSDLServiceSOAP extends WSDLService{
@ -56,7 +56,7 @@ public class WSDLServiceSOAP extends WSDLService{
// definitions -> binding -> operation -> soap:operation
Element soap_operation = operation.addElement("soap:operation");
soap_operation.addAttribute("soapAction", method.getPath());
soap_operation.addAttribute("soapAction", method.getAbsolutePath());
// ------------------------------------------------
// Input
@ -67,7 +67,7 @@ public class WSDLServiceSOAP extends WSDLService{
// definitions -> binding -> operation -> input -> body
Element input_body = input.addElement("soap:body");
input_body.addAttribute("use", "literal");
input_body.addAttribute("namespace", method.getPath());
input_body.addAttribute("namespace", method.getAbsolutePath());
// ------------------------------------------------
// Output
@ -79,7 +79,7 @@ public class WSDLServiceSOAP extends WSDLService{
// definitions -> binding -> operation -> input -> body
Element output_body = output.addElement("soap:body");
output_body.addAttribute("use", "literal");
output_body.addAttribute("namespace", method.getPath());
output_body.addAttribute("namespace", method.getAbsolutePath());
}
}
}