Twitter

WarQuest SOAP java client

Hi WarQuest player,

If you want to automate attacks, missions and/or alliance requests use the follow Java
example to interface with the WarQuest SOAP web service.

12-03-2014: Update java example. Now based on JavaCXF framework. Must cleaner java code!


package nl.warquest.client;

import nl.warquest.service.warquest.Alliance;
import nl.warquest.service.warquest.Battle;
import nl.warquest.service.warquest.Force;
import nl.warquest.service.warquest.Mission;
import nl.warquest.service.warquest.Planet;
import nl.warquest.service.warquest_wsdl.WarQuest;
import nl.warquest.service.warquest_wsdl.WarQuestPort;

public class Main {

	public static void main(String[] args) {
        		
		WarQuest warquest = new WarQuest();
		WarQuestPort port = warquest.getWarQuestPort();
				
		String username = "username";
		String password = "password";
					        
		Mission mission = port.doMission(username, password, true, false);
		System.out.println("username="+username);
		System.out.println("mission.result="+mission.isResult());
		System.out.println("mission.popup="+mission.getPopup());
						
		Battle battle = port.doBattle(username, password, Planet.EARTH, Force.AIRFORCE);
		System.out.println("username="+username);
		System.out.println("battle.result="+battle.isResult());
		System.out.println("battle.popup="+battle.getPopup());
				
		Alliance alliance = port.doAlliance(username, password);
		System.out.println("username="+username);
		System.out.println("alliance.result="+alliance.isResult());
		System.out.println("alliance.popup="+alliance.getPopup());		
	}
}

Needed MAVEM pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>nl.warquest</groupId>
  <artifactId>client</artifactId>
  <version>0.1</version>
  <name>WarQuest</name>
  <description>WarQuest client</description>
  
  <build>
    <plugins>
  		<plugin>
   			<groupId>org.apache.cxf</groupId>
    		<artifactId>cxf-codegen-plugin</artifactId>
    		<version>2.7.10</version>
    		<executions>
        		<execution>
            		<id>generate-sources</id>
            		<phase>generate-sources</phase>
            		<configuration>
                		<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                		<wsdlOptions>
                    		<wsdlOption>
                        		<wsdl>http://www.warquest.nl/service?wsdl</wsdl>
                    		</wsdlOption>
                		</wsdlOptions>
            		</configuration>
            		<goals>
                		<goal>wsdl2java</goal>
            		</goals>
        		</execution>
    		</executions>
		</plugin>
  	</plugins>
  </build>
</project>

2 comments to WarQuest SOAP java client

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>