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 else
path = name; path = name;
if (path.startsWith("/")) if (!path.startsWith("/"))
path = path.substring(1); path = '/' + path;
// ------------------------------------------------ // ------------------------------------------------
// Handle inputs // 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() { 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 // generate response XML
if (outputParamDefs.size() > 0) { if (outputParamDefs.size() > 0) {
Element response = responseRoot.addElement(""); Element response = responseRoot.addElement("");
response.addNamespace("m", methodDef.getPath() ); response.addNamespace("m", methodDef.getAbsolutePath() );
response.setName("m:" + methodDef.getName() + "Response"); response.setName("m:" + methodDef.getName() + "Response");
if (outputParams instanceof WSReturnObject) { if (outputParams instanceof WSReturnObject) {

View file

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