[JBossWS] - hibernate and web services
by ypasmk
I'm trying to use web services and it's working but when I try to use hibernate in server side i get no entity found exception..here is my server side bean
|
| @Stateless
|
| @Local( {
|
| LoginService.class
|
| })
|
| @Remote( {
|
| LoginService.class
|
| })
|
| //@SecurityDomain("JBossWS")
|
| //@RolesAllowed ({"admin", "guest"})
|
| //@RunAs("admin")
|
|
|
| /*
|
| * JBossWS Annotations
|
| */
|
| @WebService(name = "LoginService",
|
| serviceName = "LoginService",
|
| endpointInterface = "some.webservices.LoginServiceSEI"
|
| )
|
| public class LoginServiceBean implements LoginService
|
| {
|
| private static final Logger log = Logger.getLogger(LoginServiceBean.class);
|
|
|
|
|
| @PersistenceContext
|
| EntityManager em;
|
|
|
|
|
|
|
|
|
| public boolean checkUser(String userid,String passid)
|
| {
|
|
|
| log.info("checking person('"+userid+"','"+passid+"')");
|
|
|
| try{
|
|
|
| User users=(User)em.createQuery("from User where username=:username and password=:password")
|
| .setParameter("username",userid)
|
| .setParameter("password",passid)
|
| .getSingleResult();
|
| log.info("hi there");
|
|
|
| }catch(Exception e) { log.info(e.toString()); return false; }
|
| return true;
|
| //else return true;
|
|
|
| }
|
|
|
|
|
| }
|
|
and here is the exception
|
| 20:36:15,788 INFO [LoginServiceBean] javax.persistence.NoResultException: No entity found for query
|
|
any help ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982192#3982192
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982192
18 years, 1 month
[JBossWS] - Re: implementing wsse:UserNameToken
by rayymlai
Further to the last email thread:
1. A colleague of mine shows me the source code UsernameToken.java from JBossWS 1.0.3 GA. it looks like UsernameToken(Element) method does read the "Username" and "Password" from the SOAP message.
e.g.
public UsernameToken(Element element) throws WSSecurityException {
this.doc = element.getOwnerDocument();
String id = element.getAttributeNS(Constants.WSU_NS, Constants.ID);
...
Element child = Util.getFirstChildElement(element);
if (child == null || ! Constants.WSSE_NS.equals(child.getNamespaceURI()) || ! "Username".equals(child.getLocalName()))
throw new WSSecurityException("Username child expected in UsernameToken element");
this.username = XMLUtils.getFullTextChildrenFromElement(child);
child = Util.getNextSiblingElement(child);
...
}
I've tried the following permutation of changes, but I still can't make the WSS 1.0 username token profile work in JBossWS.
1. in both jboss-wsse-server.xml and jboss-wsse-client.xml, specify , e.g.
2. in the jboss-wsse*.xml, specify and (derived from the source code UsernameToken.java):
manager
manager
3. Specify username and password in the SOAP stub
(as per advice from the previous email threads)
- refer to previous reply
4. Control test - Don't specify anything in the jboss-wsse*.xml. Don't add any user or password in the SOAP stub. This is a control test, to ensure whether or has made any difference.
- no difference when running the wss samples.
Any advice?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982175#3982175
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982175
18 years, 1 month
[JBossWS] - Re: getting ip address from webservice
by RomeuFigueira
What if one doesn't have that property listed (remoteaddr?)
public boolean handleRequest(MessageContext messageContext)
| {
| String IP = (String) messageContext.getProperty("remoteaddr");
|
| System.out.println("Remote IP: " + IP);
|
| Iterator propertyNames = messageContext.getPropertyNames( );
| while ( propertyNames.hasNext( ) )
| {
| String keyName = (String) propertyNames.next( );
| System.out.println("Key: " + keyName + " Val: " + messageContext.getProperty( keyName ).toString() );
| }
| ....
| continues
| ....
|
The first one gives me null, and listing the properties shows no "remoteaddr".
| 2006-10-31 11:57:34,784 INFO [STDOUT] Remote IP: null
| 2006-10-31 11:57:34,784 INFO [STDOUT] Key: javax.xml.ws.servlet.request Val:org.apache.catalina.connector.RequestFacade@12e2fba
| 2006-10-31 11:57:34,784 INFO [STDOUT] Key: javax.xml.ws.servlet.context Val:org.jboss.ws.server.ServletEndpointContextImpl@11fc6b2
| 2006-10-31 11:57:34,784 INFO [STDOUT] Key: javax.xml.ws.servlet.response Val:org.apache.catalina.connector.ResponseFacade@31c43f
| 2006-10-31 11:57:34,784 INFO [STDOUT] Key: javax.xml.ws.servlet.session Val:org.apache.catalina.session.StandardSessionFacade@12dd1b8
|
Is there anything more to configure or am I missing something else in my calls?
Soft: Jboss AS 4.0.5, JBossWS 1.0.3 GA, Server Windows and HP-UX
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982034#3982034
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982034
18 years, 1 month
[JBossWS] - Re: Binding exception - prefix
by alesj
Ok, I made a build from these instructions
- http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQBuildAndInstallJBoss40xEJB3
(the fix is applied to branch jbossws-1.0, right? ... or should I take other branch, trunk)
But now I get this exception for a simple complex bean as parameter invocation:
My WS code:
| public class ForecastDocument implements Serializable {
|
| private String user;
| private Date date;
|
| public String getUser() {
| return user;
| }
|
| public void setUser(String user) {
| this.user = user;
| }
|
| public Date getDate() {
| return date;
| }
|
| public void setDate(Date date) {
| this.date = date;
| }
|
| @Stateless
| @WebService(endpointInterface = "com.generalynx.gema.forecast.business.ForecastSubmit")
| public class GBForecastSubmitEJB implements ForecastSubmit {
| @WebMethod
| public int submit(ForecastDocument forecastDocument) {
| System.out.println("forecastDocument = " + forecastDocument);
| return 0;
| }
| }
|
| @WebService
| @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
| public interface ForecastSubmit {
| @WebMethod
| int submit(ForecastDocument forecastDocument);
| }
|
|
Exception:
| 12:00:03,906 ERROR [SOAPFaultExceptionHelper] SOAP request exception
| javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: Type binding not found for type dateTime specified with xsi:type for element {http://business.forecast.gema.generalynx.com/jaws}date
| at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:303)
| at org.jboss.ws.binding.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:233)
| at org.jboss.ws.binding.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:103)
| at org.jboss.ws.binding.EndpointInvocation.getRequestPayload(EndpointInvocation.java:117)
| at org.jboss.ws.integration.jboss.ServiceEndpointInvokerEJB3.invokeServiceEndpoint(ServiceEndpointInvokerEJB3.java:115)
| at org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:115)
| at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:209)
| at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:355)
| at org.jboss.ws.server.StandardEndpointServlet.doPost(StandardEndpointServlet.java:115)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:76)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: Type binding not found for type dateTime specified with xsi:type for element {http://business.forecast.gema.generalynx.com/jaws}date
| at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:100)
| at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:235)
| ... 30 more
| Caused by: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: Type binding not found for type dateTime specified with xsi:type for element {http://business.forecast.gema.generalynx.com/jaws}date
| at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:67)
| at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:92)
| ... 31 more
| Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Type binding not found for type dateTime specified with xsi:type for element {http://business.forecast.gema.generalynx.com/jaws}date
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:156)
| at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
| at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:63)
| ... 32 more
| Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Type binding not found for type dateTime specified with xsi:type for element {http://business.forecast.gema.generalynx.com/jaws}date
| at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:381)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:301)
| at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
| at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
| at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
| at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
| at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
| at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:152)
| ... 34 more
My type mapping made from GLUE client:
| <?xml version='1.0' encoding='UTF-8'?>
| <!--generated by GLUE Standard 4.1.2 (wsdl2java) on Tue Oct 31 11:58:56 CET 2006-->
| <map:mappings xmlns:map='http://www.themindelectric.com/schema/'>
| <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' elementFormDefault='qualified' targetNamespace='http://business.forecast.gema.generalynx.com/jaws'>
| <xsd:complexType name='ForecastDocument' map:class='com.generalynx.gema.domain.forecast.ForecastDocument'>
| <xsd:sequence>
| <xsd:element name='date' nillable='true' map:field='date' type='xsd:dateTime'/>
| <xsd:element name='user' nillable='true' map:field='user' type='xsd:string'/>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:schema>
| </map:mappings>
Client code:
| ForecastDocument forecastDocument = new ForecastDocument();
| forecastDocument.user = "AlesJ";
| forecastDocument.date = new Date();
|
| ProxyContext proxyContext = new ProxyContext();
| proxyContext.setDocumentStyle();
|
| ForecastSubmit gbForecastSubmit = (ForecastSubmit) Registry.bind( "http://Morozevic:8080/ejb/GBForecastSubmitEJB?wsdl", ForecastSubmit.class );
| gbForecastSubmit.submit(forecastDocument);
|
Rgds, Ales
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982017#3982017
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982017
18 years, 1 month
[JBossWS] - EJB3 Webservice Exception
by cfrostrun
Hello All,
It appears to execute the webservice fine but then throws the exception on the way out, and returning the data to the client.
I'm getting the following exceptions...
21:05:13,924 INFO [STDOUT] Howdy. 1
21:05:13,928 INFO [STDOUT] url = http://www.test.com description = This is a Description hiperDate = Thu Oct 26 21:05:03 CDT 2006
21:05:14,239 ERROR [AbstractServlet] Error processing web service request
javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: javax.xml.bind.MarshalException: java.lang.ClassNotFoundException: com.frostylabs.hiperlinx.dto.loader.HiperlinxEntry
Does anybody have any idea why? My HiperlinxEntry class is part of the EJB project... Here's the Bean Implementation
@Stateless
@Remote(HiperlinxLoaderRemote.class)
@RemoteBinding (jndiBinding="HiperlinxLoaderBean/remote")
@WebService (endpointInterface="com.frostylabs.hiperlinx.services.loader.HiperlinxLoaderEndPoint")
public class HiperlinxLoaderBean implements HiperlinxLoaderRemote, HiperlinxLoaderEndPoint{
public boolean execute(HiperlinxEntry[] entries) {
System.out.println(" Howdy. " + entries.length);
// this is
// 21:05:13,928 INFO [STDOUT] url = http://www.test.com description =
// This is a Description hiperDate = Thu Oct 26 21:05:03 CDT 2006
System.out.println(entries[0].toString());
return true;
}
public String getServiceName() {
return "Hiperlinx Service";
}
}
My EndPoint Interface...
@WebService
public interface HiperlinxLoaderEndPoint {
@WebMethod
public boolean execute(HiperlinxEntry[] entries);
}
I'm on jboss 4.0.4.... any ideas? My EJB & EAR is in the deploy/ directory... So I'm not sure why I'd have to put the classes somewhere else?
Any Help would be greatful.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981938#3981938
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981938
18 years, 1 month