인증 과정에서 비즈니스 예외를 발생시키는 JAX-WS WebService를 작성하여 클라이언트가 예외를 처리하고 사용자에게 올바른 정보를 제공 할 수있게했습니다.JAX-WS 클라이언트가 잘못된/일반 WebService 예외를 수신함
WS가 4 개월 전에 사용되기 시작했는데 그때까지 모든 것이 잘 작동했지만 그 이후로 우리 고객은 많은 새로운 기능을 요구했고 여기 거의 모든 개발자가 계약을 변경했으며 이해할 수 없습니다 무엇이 잘못되었는지.
제발 도와 주시겠습니까?
@WebService
@ApplicationScoped
public class MyWS {
@WebMethod
public MyVO doSomething(parameters...) throws UserAuthenticationException {
throw new UserAuthenticationException(
"The message the business guys asked to send..."
);
}
이제 예외 클래스 :
public class UserAuthenticationException extends Exception {
private String details;
/**
*
*/
private static final long serialVersionUID = -3173043626093972452L;
public UserAuthenticationException(String msg, Throwable t) {
super(msg, t);
}
public UserAuthenticationException(String reason, String details) {
super(reason);
this.details = details;
}
public UserAuthenticationException(String msg) {
super(msg);
this.details = msg;
}
public String getFaultInfo() {
return this.details;
}
}
내 예외 오류 여기
<portType name="MyWS"><operation name="doSomething"><input message="tns:doSomething" wsam:Action="http://ws.../MyWS/doSomethingRequest">
...
</output><fault name="UserAuthenticationException" message="tns:UserAuthenticationException" wsam:Action="http://ws.../MyWS/doSomething/Fault/UserAuthenticationException">
</fault></operation>
에 매핑 된 그 WSDL에서 볼 수 있습니다 클라이언트 측의 메소드 호출이다 , 항상 catch (WebServiceException e) 블록으로 이동합니다.
** 모든 스텁/아티팩트는 cr WSImport에 의해 eated.
public void callMyWs() {
try {
//we use a proxy
MyWS myWsPort = MyWS.getMyWSPort();
myWsPort.doSomething()
} catch (UserAuthenticationException_Exception e) {
JOptionPane.showMessageDialog(e.getMessage());
->>>> //Here is where I expect it shoud go...
} catch (MalformedURLException e) {
...
} catch (WebServiceException e) {
...
//here is where it goes
} catch (Exception e) {
....
}
}
마지막으로, 내 WS 방법과 wsimport에 의해 생성 된 인터페이스는
는@WebService(name = "MyWS", targetNamespace = "...")
@XmlSeeAlso({
ObjectFactory.class
})
public interface MyWS {
/**
*
* @return
* returns MyVO
* @throws UserAuthenticationException_Exception
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(...", className = "...")
@ResponseWrapper(localName = "...", targetNamespace = "...", className = "...")
@Action(input = "...", output = "...", fault = {
@FaultAction(className = UserAuthenticationException_Exception.class, value = "ws.../MyWS/doSomething/Fault/UserAuthenticationException")
})
public MyVO doSomething(params...)
throws UserAuthenticationException_Exception
;
는 는
난 그냥 ---- 수정 됨 ---
잘못이 무엇인지 볼 수 없습니다
스택 트레이스
javax.xml.ws.ProtocolException: The message the business guys asked to send...
at org.apache.axis2.jaxws.ExceptionFactory.createProtocolException(ExceptionFactory.java:199)
at org.apache.axis2.jaxws.ExceptionFactory.makeProtocolException(ExceptionFactory.java:97)
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1370)
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.demarshalFaultResponse(MethodMarshallerUtils.java:1089)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller.demarshalFaultResponse(DocLitWrappedMethodMarshaller.java:680)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:626)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:566)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:432)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:213)
at com.sun.proxy.$Proxy29.callMyService(Unknown Source)
at package(Main.java:154)
at package.Main$1.actionPerformed(Main.java:84)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6525)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
예외의 스택 추적을 게시 할 수 있습니까? UserAuthenticationException 오류와 관련이 없지만 다른 오류로 인해 발생했을 수 있습니다. 전송 수준에서? – MGorgon
나쁘다! 나는 당신의주의를 끌기 위해 스택 추적을 게시했다. – Scrougge
클라이언트 축 버전이란 무엇입니까? 서버가 유효한 오류 메시지를 반환한다는 것을 SoapUI로 확인할 수 있었습니까? – MGorgon