@cronapp/templates 2.9.5-SP.6 → 2.9.5-SP.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -20,6 +20,33 @@ import cronapi.CronapiMetaData.*;
|
|
|
20
20
|
@CronapiMetaData(categoryName = "${className?replace("REST", "")?replace("API", "")}")
|
|
21
21
|
public class ${className} {
|
|
22
22
|
|
|
23
|
+
private static void setAuth(org.apache.axis2.client.ServiceClient client) {
|
|
24
|
+
<#if hasAuth>
|
|
25
|
+
<#if isBasicAuth>
|
|
26
|
+
var authorization = "Basic " + java.util.Base64.getEncoder().encodeToString(("${wssUser}"+ ":" + "${wssPwd}").getBytes());
|
|
27
|
+
var namedValuePairs = new java.util.ArrayList<org.apache.axis2.context.NamedValue>();
|
|
28
|
+
namedValuePairs.add(new org.apache.axis2.context.NamedValue("Authorization", authorization));
|
|
29
|
+
client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS, namedValuePairs);
|
|
30
|
+
<#else>
|
|
31
|
+
OMFactory fac = OMAbstractFactory.getOMFactory();
|
|
32
|
+
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
|
|
33
|
+
OMNamespace nsWSSE = fac.createOMNamespace("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "wsse");
|
|
34
|
+
org.apache.axiom.soap.SOAPHeaderBlock header = factory.createSOAPHeaderBlock("Security", nsWSSE);
|
|
35
|
+
header.setMustUnderstand(true);
|
|
36
|
+
OMElement usernameToken = fac.createOMElement("UsernameToken", nsWSSE);
|
|
37
|
+
OMElement username = fac.createOMElement("Username", nsWSSE);
|
|
38
|
+
username.setText("${wssUser}");
|
|
39
|
+
usernameToken.addChild(username);
|
|
40
|
+
OMElement password = fac.createOMElement("Password", nsWSSE);
|
|
41
|
+
password.addAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText", null);
|
|
42
|
+
password.setText("${wssPwd}");
|
|
43
|
+
usernameToken.addChild(password);
|
|
44
|
+
header.addChild(usernameToken);
|
|
45
|
+
client.addHeader(header);
|
|
46
|
+
</#if>
|
|
47
|
+
</#if>
|
|
48
|
+
}
|
|
49
|
+
|
|
23
50
|
<#list baseInfo.methods as method>
|
|
24
51
|
@CronapiMetaData(type = "function", returnType = ObjectType.OBJECT)
|
|
25
52
|
public static Var ${method.methodName} (
|
|
@@ -36,30 +63,8 @@ ${method.returnType} respn = null;
|
|
|
36
63
|
|
|
37
64
|
|
|
38
65
|
${baseInfo.stubClass} stub = new ${baseInfo.stubClass}();
|
|
66
|
+
${className}.setAuth(stub._getServiceClient());
|
|
39
67
|
|
|
40
|
-
<#if hasAuth>
|
|
41
|
-
OMFactory fac = OMAbstractFactory.getOMFactory();
|
|
42
|
-
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
|
|
43
|
-
OMNamespace nsWSSE = fac.createOMNamespace("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "wsse");
|
|
44
|
-
|
|
45
|
-
org.apache.axiom.soap.SOAPHeaderBlock header = factory.createSOAPHeaderBlock("Security", nsWSSE);
|
|
46
|
-
header.setMustUnderstand(true);
|
|
47
|
-
|
|
48
|
-
OMElement usernameToken = fac.createOMElement("UsernameToken", nsWSSE);
|
|
49
|
-
|
|
50
|
-
OMElement username = fac.createOMElement("Username", nsWSSE);
|
|
51
|
-
username.setText("${wssUser}");
|
|
52
|
-
|
|
53
|
-
usernameToken.addChild(username);
|
|
54
|
-
|
|
55
|
-
OMElement password = fac.createOMElement("Password", nsWSSE);
|
|
56
|
-
password.addAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText", null);
|
|
57
|
-
password.setText("${wssPwd}");
|
|
58
|
-
usernameToken.addChild(password);
|
|
59
|
-
header.addChild(usernameToken);
|
|
60
|
-
ServiceClient sender = stub._getServiceClient();
|
|
61
|
-
sender.addHeader(header);
|
|
62
|
-
</#if>
|
|
63
68
|
<#list baseInfo.getAllObjectsToInstance(method) as param>
|
|
64
69
|
<#if param.hasArgumentsInConstructor>
|
|
65
70
|
//Constructor has arguments - requires manual implementation
|