Я работал над этим проектом, проект основывается на c веб-сервисе с логином и регистрацией. Веб-сервис работает совершенно нормально, но на стороне клиента возникли некоторые проблемы. Я создал клиентскую часть, используя Net bean-клиент, использующий файл WDSL / также проект, и получаю эту ошибку:
Exception in thread "AWT-EventQueue-0" javax.xml.ws.WebServiceException: class org.me.sharesbrokeringsystem.LogIn do not have a property of the name username
at com.sun.xml.internal.ws.client.sei.BodyBuilder$DocLit.<init>(BodyBuilder.java:230)
at com.sun.xml.internal.ws.client.sei.StubHandler.<init>(StubHandler.java:117)
at com.sun.xml.internal.ws.db.DatabindingImpl.initStubHandlers(DatabindingImpl.java:145)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:90)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)
at org.me.sharesbrokeringsystem.SharesBrokeringSystem_Service.getSharesBrokeringSystemPort(SharesBrokeringSystem_Service.java:72)
at shares.brokering.client.Login.logIn(Login.java:246)
at shares.brokering.client.Login.LoginButtonActionPerformed(Login.java:146)
at shares.brokering.client.Login.access$000(Login.java:21)
at shares.brokering.client.Login$1.actionPerformed(Login.java:60)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
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:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
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$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
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)
Caused by: javax.xml.bind.JAXBException: username is not a valid property on class org.me.sharesbrokeringsystem.LogIn
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:934)
at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(JAXBRIContextWrapper.java:106)
at com.sun.xml.internal.ws.client.sei.BodyBuilder$DocLit.<init>(BodyBuilder.java:227)
... 54 more
Это код, который я использую
private static Client logIn(java.lang.String username, java.lang.String password) {
org.me.sharesbrokeringsystem.SharesBrokeringSystem_Service service = new org.me.sharesbrokeringsystem.SharesBrokeringSystem_Service();
org.me.sharesbrokeringsystem.SharesBrokeringSystem port = service.getSharesBrokeringSystemPort();
return port.logIn(username, password);
}
XSD схема:
<xs:complexType name="Client">
<xs:sequence>
<xs:element name="id" type="xs:int"/>
<xs:element name="username" type="xs:string"/>
<xs:element name="Balance" type="xs:double"/>
<xs:element name="SharesList" type="tns:SymbolVolume" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>