用春季靴子消费肥皂服务

时间:2017-12-04 15:29:44

标签: java spring web-services spring-boot

我正在尝试为以下Web服务构建客户端:

https://testagent.tutasa.com.ar/AR_Tutasa_Agent_API_staging.wsdl

遵循春季启动教程:

https://spring.io/guides/gs/consuming-web-service/

我当前的问题我收到HTTP 403错误。服务器没有进行HTTP基本身份验证。

这是任何操作的例外:

org.springframework.ws.client.WebServiceTransportException: Forbidden [403]

at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:699)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:609)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378)
at com.tutasa.tutasawsclient.ar.AgentClientStaging.withdrawalConsultation(AgentClientStaging.java:50)
at ar.com.tutasa.rapipagoconnector.AgentClientStagingTest.withdrawConsultationAR(AgentClientStagingTest.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

证书可能出错吗?

我试图在SOAPUI中调用它,而http://www.soapclient.com/soaptest.html它工作得很好......很奇怪。

以下是代码:

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>com.tutasa</groupId>
<artifactId>tutasa-ws-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>tutasa-ws-client</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>


<dependencies>

    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>3.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-support</artifactId>
        <version>3.0.0.RELEASE</version>
    </dependency>

</dependencies>

<build>
    <plugins>

        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.13.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaLanguage>WSDL</schemaLanguage>
                <generatePackage>ar.com.tutasa.staging</generatePackage>
                <schemas>
                    <schema>
                        <url>${project.basedir}/src/main/resources/ar/AR_Tutasa_Agent_API_staging.wsdl</url>
                    </schema>
                </schemas>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

    </plugins>
</build>

AgentConfig类

package com.tutasa.tutasawsclient;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;


 @Configuration
 public class AgentConfig {

@Bean
public com.tutasa.tutasawsclient.ar.AgentClientStaging testAgentClientAR() throws Exception {
    com.tutasa.tutasawsclient.ar.AgentClientStaging client = new com.tutasa.tutasawsclient.ar.AgentClientStaging();
    client.setDefaultUri("https://testagent.tutasa.com.ar/Tutasa_Agent_APISoap.php");

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("ar.com.tutasa");

    client.setMarshaller(marshaller);
    client.setUnmarshaller(marshaller);


    return client;
}
}

AgentClientStaging类

 public class AgentClientStaging extends WebServiceGatewaySupport {

 public static final String API_URL = "https://testagent.tutasa.com.ar/Tutasa_Agent_APISoap.php"; 

public WithdrawalConfirmationResponse    withdrawalConfirmation(WithdrawalConfirmation request) {
    return (WithdrawalConfirmationResponse) getWebServiceTemplate().marshalSendAndReceive(API_URL, request);
}
}

0 个答案:

没有答案