Skip to content

moltak/Rx-Soap

Repository files navigation

Rx-Soap Build Status Release GitHub license codecov.io Stories in Ready

Rx-Soap library for reactive java and android.

Add it to your build.gradle with:

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
	compile 'com.github.moltak:rx-soap:1.0'
}

How to use

Send request
BaseSoapAdapter adapter = new SoapAdapterFactory.Builder<>()
    .setEndpoint("http://soap-endpoint.com/")
    .setWebserviceName("/WebServices/Soap.asmx")
    .enableDebug() // Enable debug mode for print log
    .setTimeout(5000) // Default timeout(5 seconds)
    .setLogLevel(BaseSoapAdapter.LogLevel.FULL) // It prints logs.
    .setSoapPrinter(new DefaultSoapPrinter()) // Default soap printer(xml, http response) codes
    .build();

Observable<GetObjectResponse> o
        = adapter.create(new GetObjectRequest("name"))
        .async(GetObjectResponse.class);
o.subscribe(new Action1<GetObjectResponse>() {
    @Override
    public void call(GetObjectResponse results) {
        // There are results.
    }
}, new Action1<Throwable>() {
    @Override
    public void call(Throwable throwable) {

    }
});
Request model
public class GetObjectRequest implements BaseRequest {
    private final String name;

    public GetObjectRequest(String name) {
        this.name = name;
    }

    @Override
    public String getRequestName() {
        return "get_info"; // This is an action name for soap request.
    }

    @Override
    public Map<String, String> getParams() throws IllegalAccessException, InvocationTargetException {
        return ParameterBaker.bake(this);
    }

    public String getName() {
        return name;
    }
}
Response model. Annotation based parsing.
public class GetObjectResponse {
    @JSoapResField(name = "name")
    private String name;

    @JSoapResField(name = "gender")
    private String gender;

    public String getName() {
        return name;
    }

    public String getGender() {
        return gender;
    }
}
Run tests using gradle
./gradlew test
Run tests using mvn
mvn test

License

Copyright 2015 Jung Kyungho.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Rx-Soap library for java and android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages