小编ram*_*027的帖子

在apache axis2客户端中获取传输错误

在我的项目中,我正在尝试创建一个休息客户端apache axis 1.62,它之前正在工作SSL.由于服务器配置更改和代理已添加,当我试图访问webservice现在我得到以下错误

                org.apache.axis2.AxisFault: Transport error: 403 Error: PortcullisNoMatch
            at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
            at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
            at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
            at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
            at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
            at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
            at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
            at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
            at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
            at com.services.integration.impl.live.LoginRepositoryStubImpl.login(LoginRepositoryStubImpl.java:305)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
            at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
            at com.db.mybank.backend.managers.ProfileManagerImpl.showMethodTimeAndObjects(ProfileManagerImpl.java:129)
            at org.appverse.web.framework.backend.api.aop.advices.ProfilingAdvice.invoke(ProfilingAdvice.java:38)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
            at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
            at $Proxy29.login(Unknown Source)
Run Code Online (Sandbox Code Playgroud)

我使用以下代码进行代理身份验证

                HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator();
            HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties(); …
Run Code Online (Sandbox Code Playgroud)

java rest ssl axis web-services

7
推荐指数
0
解决办法
3197
查看次数

与json的春天休息junit岗位

我正在尝试使用项目为spring rest webservice创建junit测试.使用get方法可以正常工作,但它确实可以使用post json作为输入.这是带get方法的代码.如果有人帮助休息发布json junit测试,它将不胜感激.

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations=("/spring/application-config.xml"))
public class LoginServiceFacadeTestImpl extends AbstractTest {

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @Before
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    }


    @Test
    public void testSearchProductByNameFound() throws Exception {
        String keyword = "";
        this.mockMvc.perform(get("/perlogin")
            .param("q", keyword)
            .accept(MediaType.APPLICATION_JSON))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON))
            .andExpect(jsonPath("$.name").value(keyword));
    }
}
Run Code Online (Sandbox Code Playgroud)

但我得到的错误如下

Time elapsed: 5.477 sec  <<< FAILURE!
java.lang.AssertionError: Status expected:<200> but was:<404>
    at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:60)
    at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:89)
    at org.springframework.test.web.servlet.result.StatusResultMatchers$5.match(StatusResultMatchers.java:549)
    at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:141)
    at com.db.mybank.backend.services.presentation.impl.test.LoginServiceFacadeTestImpl.testSearchProductByNameFound(LoginServiceFacadeTestImpl.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at …
Run Code Online (Sandbox Code Playgroud)

java rest junit spring json

5
推荐指数
1
解决办法
7493
查看次数

标签 统计

java ×2

rest ×2

axis ×1

json ×1

junit ×1

spring ×1

ssl ×1

web-services ×1