我想使用ihomefinder的测试API来获取数据并将其插入到我自己的数据库中。我正在使用Spring MVC以及我在pom.xml中配置的链接,以获取数据http://axisws.idxre.com:8080/axis2/services/IHFPartnerServices?wsdl。
从各种搜索中我发现所有提供的API都在包com.ihomefinder.api
中,所以我也把它包含在pom.xml中
这是pom.xml代码:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.ihomefinder.api</generatePackage>
<schemas>
<schema>
<url>http://axisws.idxre.com:8080/axis2/services/IHFPartnerServices?wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
</plugins>
</build>
现在我尝试使用他们提供的测试用户名和密码登录,但是要点击登录服务,我需要创建在请求包com.ihomefinder.api
中找不到的Object of Object类。
以下是我用来发出请求的java代码:
import javax.xml.bind.JAXBElement;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.client.core.SoapActionCallback;
import com.ihomefinder.api.Login;
import com.ihomefinder.api.ObjectFactory;
public class IdxMls extends WebServiceGatewaySupport {
public void main() {
// TODO Auto-generated method stub
ObjectFactory objectFactory = new ObjectFactory();
JAXBElement<String> user = objectFactory.createLoginUsername("username");
JAXBElement<String> pass = objectFactory.createLoginPassword("password");
Login login = new Login();
login.setUsername(user);
login.setPassword(pass);
Integer int1 = (Integer) getWebServiceTemplate().marshalSendAndReceive(login, new SoapActionCallback("http://axisws.idxre.com:8080/axis2/services/Login"));
System.out.println(int1);
}
public static void main(String[] args) {
IdxMls idxMls = new IdxMls();
idxMls.main();
}
}
我认为上面的代码并不完美,有些东西确实缺失了。那么有人可以帮我纠正我可以从API获得响应的代码吗?
答案 0 :(得分:0)
看起来您正在使用我们的合作伙伴API soap客户端。我们最新的Reseller API是REST API,入口点URL是:
https://www.idxhome.com/restServices/reseller/login
目前尚未公开发布经销商API的文档。请发送电子邮件至support@ihomefinder.com,我们很乐意为您提供文件。