Skip to content

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jsoap

Build Status Coverage Status

The last SOAP library you'll ever use.

Installation

make (software) or include this dependency as a remote artifact into the build of your project:

gradle

Include in your root build.gradle:

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.connorvanelswyk:Jsoap:LATEST'
}

maven

Include in your pom.xml:

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.connorvanelswyk</groupId>
    <artifactId>jsoap</artifactId>
    <version>1.0.2</version>
</dependency>

sbt

Include in your build.sbt:

resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.connorvanelswyk" % "Jsoap" % "LATEST"

leiningen

Include in your project.clj:

:repositories [["jitpack" "https://jitpack.io"]]
:dependencies [[com.github.connorvanelswyk/Jsoap "LATEST"]]

Usage

public class RequestTests {
    
    @Test
    public void simpleTest() {
        
        Request request = new Request()
                        .encoding("ISO-8859-1")
                        .wsdl("https://graphical.weather.gov:443/xml/SOAP_server/ndfdXMLserver.php")
                        .body("https://graphical.weather.gov/xml/docs/SOAP_Requests/LatLonListZipCode.xml");
                
        String expected = "{\"\":\"39.0138,-77.0242 39.2851,-77.8575\"}";
        
        String actual = Jsoap.getInstance().send(request);
        
        assertEquals(expected, actual);
    }
    
    @Test
    public void complexTest() {
        
        String requestedTime =
                DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(
                        LocalDateTime.now()
                                .plus(Duration.ofDays(5))
                                .truncatedTo(ChronoUnit.SECONDS));
        
        Request request = new Request()
                .encoding("ISO-8859-1")
                .wsdl("https://graphical.weather.gov:443/xml/SOAP_server/ndfdXMLserver.php")
                .body("https://graphical.weather.gov/xml/docs/SOAP_Requests/GmlLatLonList.xml")
                .params("requestedTime", requestedTime)
                .schema("gml:boundedBy", "gml:coordinates")
                .schema("gml:featureMember", "gml:coordinates", "app:validTime", "app:maximumTemperature");
        
        String expected = "{\"gml:featureMember\":[{\"app:validTime\":\"2019-07-14T18:46:44\",\"gml:coordinates\":\"-77.02,38.99\",\"app:maximumTemperature\":\"91.0\"},{\"app:validTime\":\"2019-07-14T18:46:44\",\"gml:coordinates\":\"-122.30,47.6\",\"app:maximumTemperature\":\"73.0\"},{\"app:validTime\":\"2019-07-14T18:46:44\",\"gml:coordinates\":\"-104.80,39.70\",\"app:maximumTemperature\":\"92.0\"}],\"gml:boundedBy\":{\"gml:coordinates\":\"-122.30,38.99 -77.02,47.6\"}}";

        String actual = Jsoap.getInstance().send(request);
        
        assertEquals(expected, actual);
    }
    
}

Examples

See Jsoap-api.


About

The last SOAP library you'll ever use.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages