Skip to content

Instantly share code, notes, and snippets.

@avvero
avvero / soap_call.groovy
Last active December 15, 2015 05:09
Soap call groovy
import javax.xml.soap.*;
import javax.xml.namespace.QName;
String LOGIN = "login";
String PASSWORD = "password";
String TXN = "txn";
String STATUS = "status";
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
@avvero
avvero / iterate through hashmap.java
Created March 20, 2013 17:22
iterate through hashmap
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
// ...}
@avvero
avvero / ajax response.java
Created March 20, 2013 17:28
ajax response.
try {
//Получаем параметры
PaymentSystemsCompensationsProxy.modifyCommissCompSettings(request);
JSONObject param = new JSONObject();
param.put("success", true);
sendResponse(param, response);
} catch (FxException e) {
log.error(e.getLocalizedMessage(), e);
JSONObject param = new JSONObject();
param.put("success", false);
String data = request.getStringParameter("data");
JSONArray jsonArray = JSONArray.fromObject(data);
JSONObject jsonObject;
for (int i = 0; i < jsonArray.size(); i++) {
jsonObject = jsonArray.getJSONObject(i);
Object[] detailsParams = {
"ID", entry.getId(),
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import javax.xml.ws.BindingProvider;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.configuration.security.AuthorizationPolicy;
//Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
URL url = new URL("http://localhost:8089/service?wsdl");
Client client = dcf.createClient(url);
task listJars << {
configurations.testRuntime.each { File file ->
println file.name
new File("c:/Work/Temp/jars/"+file.name) << file.bytes
}
}
configurations {
testRuntime.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
testCompile.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
testRuntime.exclude group: 'org-fx.apache.cxf', module: 'cxf-bundle'
testCompile.exclude group: 'org-fx.apache.cxf', module: 'cxf-bundle'
testRuntime.exclude group: 'org.apache.ws.commons.schema', module: 'XmlSchema'
testCompile.exclude group: 'org.apache.ws.commons.schema', module: 'XmlSchema'
testRuntime.exclude group: 'axis', module: 'axis-wsdl4j'
testCompile module('org.apache.cxf:cxf-bundle:2.7.4') {
dependencies(
"org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016@jar",
"org.eclipse.jetty:jetty-continuation:8.1.2.v20120308",
"org.eclipse.jetty:jetty-http:8.1.2.v20120308"
)
}
testCompile 'org.codehaus.woodstox:woodstox-core-asl:4.2.0'
testCompile 'org.apache.cxf:cxf-api:2.7.4'
testCompile 'org.apache.cxf:cxf-rt-frontend-jaxws:2.7.4'
@avvero
avvero / tomcat webapp.xml
Last active December 16, 2015 06:39
c:\Work\Tomcat\tomcat7_DealStub\conf\Catalina\localhost\ROOT.xml
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="c:/Work/Dev/Unittests/DealStub/web">
<!-- Path to additional resources -->
<!-- Only for development mode -->
<Loader className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="c:/Work;c:/Work/lib/*.jar"/>
<!-- Only for development mode --><JarScanner/>
<JarScanner/>
</Context>
@avvero
avvero / tomcat webapp root.xml
Last active December 16, 2015 07:49
Hot deploay reloadable="true" checkInterval="5" debug="5"
<?xml version='1.0' encoding='utf-8'?>
<Context aliases=""
docBase="c:/Work/Dev/app/web">
<!-- Path to additional resources -->
<Environment name="test.res-path" value="c:/Work/Dev/app/res" type="java.lang.String" override="false"/>
<!-- Only for development mode -->
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" reloadable="true" checkInterval="5" debug="5"
virtualClasspath="c:/Work/Dev/app/build/classes/main;c:/Work/Dev/app/lib/*.jar"/>
<!-- Only for development mode --><JarScanner/>