Azure event hub processor doesn't work with enterprise proxy - azure-eventhub

I am working with Azure event hub sender and processor tutorial and I'am sitting behind a enterprise proxy.
Sending events to the event hub works really fine, but i have problems to let get eventHubProcessor access to the Azur event hub. It seems to me that I have some proxy problems.
I use
DefaultEndpointProtocol=https
as storage connection string and I set
ServiceBusEnvironment.SystemConnectivity.Mode =
ConnectivityMode.Https;
I also tryed many different variations to set the proxy in App.config file. E.g.
<configSections>
<sectionGroup name="proxyGroup">
<section name="basicProxy" type="Proxy.Configuration.CustomProxySection, Proxy" />
</sectionGroup>
</configSections>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true" >
<proxy usesystemdefault="true"/>
</defaultProxy>
</system.net>
Witout any success :(
At "eventProcessorHost.RegisterEventProcessorAsync(options).Wait();" I get the exception
InnerException:
HResult=-2146233087
Message=Der angeforderte Name ist gültig, es wurden jedoch keine Daten des angeforderten Typs gefunden
Source=Microsoft.ServiceBus
StackTrace:
Server stack trace:
Exception rethrown at [0]:
bei Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
bei Microsoft.ServiceBus.Messaging.Amqp.Transport.WebSocketTransportInitiator.Complete(IAsyncResult connectAsyncResult, Boolean completeSynchronously)
Exception rethrown at [1]:
bei Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
bei Microsoft.ServiceBus.Messaging.Amqp.AmqpMessagingFactory.ConnectAsyncResult.<GetAsyncSteps>b__9d(ConnectAsyncResult thisPtr, IAsyncResult r)
bei Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
Exception rethrown at [2]:
bei Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
bei Microsoft.ServiceBus.Messaging.Amqp.AmqpMessagingFactory.EndCreateConnection(IAsyncResult result)
bei Microsoft.ServiceBus.Messaging.Amqp.FaultTolerantObject`1.CreateAsyncResult.<GetAsyncSteps>b__1(CreateAsyncResult thisPtr, IAsyncResult r)
bei Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
Exception rethrown at [3]:
bei Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
bei Microsoft.ServiceBus.Common.AsyncResult`1.End(IAsyncResult asyncResult)
Does anyone has an idea??
Many many thanks for your time.
Regards, Roland

Reason for the problem is that ServicePointManager does not support proxys in case of HTTPS.
To solve the problem change everything to HTTP
In your main program:
string storageConnectString=string.Format("DefaultEndpointsProtocol=http;....");
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;
In your App.config
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true" >
<proxy
autoDetect="false"
bypassonlocal="true"
proxyaddress="http://##.###.###.###:8080"
usesystemdefault="false"/>
</defaultProxy>
</system.net>

Related

Unmarshalling error in apache camel with jaxb data format

I am completely new to camel and jboss fuse and I am facing one problem. I am trying to send a request to my webservice using soapUI.I have used cxf component of apache camel and jaxb in apache camel. In the request there is a tag AuthTimeStamp.
When I am entering
<AuthTimestamp>2009-01-02T11:13:56.745+05:30 </AuthTimestamp>
it is working fine. But when I am entering:
<AuthTimestamp>3-23-190017:00</AuthTimestamp>
it is giving me error. I believe jaxb is doing some kind of validation and my request is failing there. But I don't to return soap fault type error.
I want a proper xml to be returned with proper information. If the request passes to my cxf bean then I can handle the exception make a proper error packet and return it. Similar questions have been asked before but I was not able to find appropriate solution.
Initial part of my camel route:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Service for gateway is exposed. cxfEndpoint mentioned in EsangamBeanConfig.xml-->
<!-- <to uri="bean:NSDGPortTypeImpl"/> -->
<!-- <simple>${body.getIISMessage()}</simple> -->
<!-- <to uri="bean:iISMessageProcessorID?method=logTransaction(${body})"/>
-->
<!--Here goes IISMessageContext(body) -->
<!--Here goes SubmitDocument(body) -->
<!--Here goes IISMessageContext(body) -->
<camelContext id="eSangamMessagingCamelContext" xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<jaxb contextPath="in.gov.esangam.eservices.messaging" prettyPrint="true" encoding="UTF-8" id="myJaxb"/>
</dataFormats>
<route id="eSangam Messaging Start">
<from uri="cxf:bean:NSDGPortType"/>
<log message="New Request Arrived at Gateway"/>
Below is the stack trace:
14:47:31,842 | WARN | qtp1545452967-60 | PhaseInterceptorChain | 118 - org.apache.cxf.cxf-core - 3.0.4.redhat-620133 | Interceptor for {http://www.mit.gov.in/eGov/schema/NSDG/wsdl}NSDGPortTypeService#{http://www.mit.gov.in/eGov/schema/NSDG/wsdl}processSubmitDocument has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: 3/23/19005:00:00PM
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:908)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:712)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:176)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:194)[131:org.apache.cxf.cxf-rt-wsdl:3.0.4.redhat-620133]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620133]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620133]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)[89:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0.0]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)[101:org.ops4j.pax.web.pax-web-jetty:3.2.3]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)[101:org.ops4j.pax.web.pax-web-jetty:3.2.3]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:75)[101:org.ops4j.pax.web.pax-web-jetty:3.2.3]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.Server.handle(Server.java:370)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: 3/23/19005:00:00PM
- with linked exception:
[java.lang.IllegalArgumentException: 3/23/19005:00:00PM]]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:483)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:417)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:394)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:858)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:102)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(JAXBEncoderDecoder.java:897)
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_91]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:895)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
... 40 more
Caused by: javax.xml.bind.UnmarshalException: 3/23/19005:00:00PM
- with linked exception:
[java.lang.IllegalArgumentException: 3/23/19005:00:00PM]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:740)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:770)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:766)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:275)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:69)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:589)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:338)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:216)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:185)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:415)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
... 46 more
Caused by: javax.xml.bind.UnmarshalException: 3/23/19005:00:00PM
- with linked exception:
[java.lang.IllegalArgumentException: 3/23/19005:00:00PM]
... 56 more
Caused by: java.lang.IllegalArgumentException: 3/23/19005:00:00PM
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseYear(Unknown Source)[:]
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(Unknown Source)[:]
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.<init>(Unknown Source)[:]
at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(Unknown Source)[:]
at com.sun.xml.bind.DatatypeConverterImpl._parseDateTime(DatatypeConverterImpl.java:378)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:279)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:277)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.FilterTransducer.parse(FilterTransducer.java:84)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:245)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:65)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
... 51 more
14:47:31,846 | INFO | qtp1545452967-60 | Soap12FaultOutInterceptor | 134 - org.apache.cxf.cxf-rt-bindings-soap - 3.0.4.redhat-620133 | class org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor$Soap12FaultOutInterceptorInternalapplication/soap+xml

How can i handle Apache Camel NoRouteToHostException exception?

i want to treat the case when connection with Camel HTTP component cannot be established
example:
<from uri="timer:tm?period=2000"/>
<to uri="https://URI"/>
when there is no connection i get this exception:
java.net.NoRouteToHostException: No route to host: connect
I want to handle this response and change it to an understandable message by the consumer. How can i do this ?
Camel provides a couple of very powerful error handling mechanisms with very useful redelivery and deadletter functionality. Those include:
Error Handlers: https://camel.apache.org/error-handler.html
Dead Letter Channels: https://camel.apache.org/dead-letter-channel.html
Try, Catch & Finally: https://camel.apache.org/try-catch-finally.html
Exception Clause: https://camel.apache.org/exception-clause.html
For your usecase, Exception Clause is the best fit. Redelivery would help you to retry the HTTP call and avoid failure due to a temporary downtime, e.g. a server restart:
<onException>
<exception>java.net.NoRouteToHostException</exception>
<!-- retry 3 times with a delay of 10 seconds -->
<redeliveryPolicy maximumRedeliveries="3" logStackTrace="true" redeliveryDelay="10000" />
<!-- only logs once redeliveries have failed -->
<to uri="log:classToLog?level=ERROR"/>
</onException>
You can handle exception using try..catch..finally.
http://camel.apache.org/try-catch-finally.html
Example in Spring DSL:
<route id="send_request">
<from uri="timer:tm?period=2000" />
<doTry>
<to uri="https://URI" />
<doCatch>
<exception>java.net.NoRouteToHostException</exception>
<handled>
<constant>true</constant>
</handled>
<log message="Some Message : ${exception.message}"
loggingLevel="WARN" />
</doCatch>
</doTry>

How to handle endpoint failure in wso2esb and wso2dss

I created proxy services using wso2dss for data insertion, so services working fine I am quite happy with this. But while any data duplication errors occurred in wso2dss I need to handle it in wso2esb so I kept this property in wso2esb for dss level error handle:
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
So its working fine I am getting 50000 code using this I am able to handle error while this error my esb showing this message:
[2014-03-07 11:22:40,778] INFO - LogMediator To: /services/GeoLocationInsertion, MessageID: urn:uuid:b51629e2-934e-4227-8f50-65fd9f719b8e, Direction: request, userid = -1212807836, username = sa|214057357158656, password = sa
[2014-03-07 11:22:40,783] INFO - LogMediator To: /services/ServiceLogin, MessageID: urn:uuid:1967bde1-d820-46f9-957d-55fbb6f7ea9e, Direction: request, usercode = sa, clientid = 214057357158656
[2014-03-07 11:22:40,833] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:24aea5ed-f4e2-4214-809b-b3101031edf7, Direction: response, faisal = true
[2014-03-07 11:22:40,838] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, kk = true
[2014-03-07 11:22:40,853] WARN - EndpointContext Endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 will be marked SUSPENDED as it failed
[2014-03-07 11:22:40,853] WARN - EndpointContext Suspending endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Fri Mar 07 11:23:10 IST 2014
[2014-03-07 11:22:40,856] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 500000, ERROR_MESSAGE = null
[2014-03-07 11:22:40,857] INFO - LogMediator To: , WSAction: , SOAPAction: , MessageID: urn:uuid:42a17360-cd04-43bc-83ef-1f53b639de11, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ResponseJSON><Body><Data><Exception>duplicate key value violates or The system is attempting to access an inactive service </Exception></Data></Body><Status>500000</Status></ResponseJSON></soapenv:Body></soapenv:Envelope>
Above error message means my endpoint gone into suspend mode after 30sec it will automatically in active mode.
If any user tries on the same time he is unable to insert his correct data and he is losing the data due to endpoint nonavailability. So how we can keep endpoint in active mode?
If any other error will come this issue is not raising:
[2014-03-07 11:22:40,853] WARN - EndpointContext Suspending endpoint : endpoint_71f1485e740c2b97ec407fe4d3bf86929122480f208b6642 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Fri Mar 07 11:23:10 IST 2014
So how would I do this?
If I remove the property I am unable to handle DSS level message and I am getting error like this even my user not getting any response:
[2014-03-07 11:20:51,816] ERROR - NativeWorkerPool Uncaught exception
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFault
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.getFault(SOAPBodyImpl.java:120)
at org.apache.synapse.util.POXUtils.convertSOAPFaultToPOX(POXUtils.java:46)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:91)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:308)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:92)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:232)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
So that 30sec are so important, it causes my client's data loss. How could I avoid this endpoint failure?
The actual error in wso2dss is:
Nested Exception:-
org.postgresql.util.PSQLException: ERROR: column "deviceid" is of type bigint but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Position: 81
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:105)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.getReader(DSOMDataSource.java:116)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getDirectReader(OMSourcedElementImpl.java:225)
... 41 more
I handle it in wso2esb fault and working fine also but endpoint failure is uncatchble
If you want to configure your DSS endpoint's suspension behavior in the ESB, please refer to the Endpoint Error Handling documentation.
If you drop the FORCE_ERROR_ON_SOAP_FAULT property, you should still be able to handle a soap fault from your DSS response in the out sequence of an ESB proxy.
yo can disable that config with this configuration in your endpoint:
<?xml version="1.0"?>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService">
<timeout>
<duration>30000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<initialDuration>0</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
</endpoint>
I came up with this error myself and it was terrible to identify it and find a way to work with it. It seems there is a bug in older versions of WSO2 ESB (we have this problem with version 4.8.1) when dealing with a returned soap fault.
You can see the answer of #JorgeInfanteOsorio to disable the endpoint suspension, but you will need an workaround for the "Uncaught exception" issue. What I found is that it is possible to retrieve the parameters from the fault message and then "clear" the current payload, so any subsequent calls wont return the exception issue.
Example:
<!--
After we call a webservice on DSS or other webservice we check if the message contains a fault message
-->
<property xmlns:s="http://www.w3.org/2003/05/soap-envelope"
name="return_fault"
expression="/s:Envelope/s:Body/s:Fault"/>
<filter source="boolean(get-property('return_payzen_fault'))" regex="true">
<then>
<!--
There is a fault message on the payload...
-->
<!--
Retrieve the information from the fault message. How you will access it and which information you will retrieve may be different depending if the answer comes from a third part webservice or from your own DSS.
-->
<property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultcode"/>
<property xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" name="code" expression="/s:Envelope/s:Body/s:Fault/s:Code/s:faultstring"/>
<!--
Clear the payload containing the fault message
-->
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body/>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<!--
Now you can proceed and process the message as usual without getting the exception. You may probably use the parameters stored in the properties at the beginning to determine which error occured and what you are going to do next.
-->
</then>
</filter>
<!--
There is no fault message, you can proceed with the message processing here.
-->

Error obtaining the response from a Web Service call

I am trying to consume a Web Service and, though apparently all my parameters seem to be okay, I keep getting an erro page as response instead of an array of bytes which is what I am expecting and what the WebService is supposed to return.
My objective is to Seal a file in order to make them only readable for the right people. I am using the IRM Oracle Web Services to acomplish that, but, though all my parameters semm alright, I can't get the reponse properly.
Acording to the Oraclel support, my request is fine, so it must be something on IIS I guess. Any help?
Exception Message:
The content type multipart/related;start="";type="application/xop+xml";boundary="uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73";start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 748 bytes of the response were: '--uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73 Content-Id: Content-Type: application/xop+xml;charset=utf-8;type="text/xml" Content-Transfer-Encoding: binary '.
Exception Stacktrace:
Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream, String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter.ConvertToPDF.Page_Load(Object sender, EventArgs e)
Exception Data:
System.Collections.ListDictionaryInternal
Exception Source:
mscorlib
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/vnd.sealedmedia.softseal.pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=Relatorio.spdf");
SealingServicesClient sealingServicesClient =
new SealingServicesClient("SealingServices");
sealingServicesClient.ClientCredentials.UserName.UserName =
ConfigurationManager.AppSettings["Irm-user"];
sealingServicesClient.ClientCredentials.UserName.Password =
ConfigurationManager.AppSettings["Irm-password"];
// Create the classification details used in the sealing options
SealingOptions sealingOptions = new SealingOptions();
// This just set several parameters which the WebService validates. (They're all okay)
sealingOptions.classification = GetClassificationSetUp();
String mimeType = "application/pdf";
// Here is where everything goes wrong. I keep getting an error message.
byte[] sealedFile = sealingServicesClient.Seal(file, mimeType, sealingOptions);
if (sealedFile != null && sealedFile.Length > 0)
{
Response.AddHeader("Content-Length", sealedFile.Length.ToString());
Response.BinaryWrite(sealedFile);
Response.Flush();
Response.End();
}
Meu WebConfig está desse jeito:
<system.serviceModel>
<client>
<endpoint address="https://url:porta/irm_sealing/sealing_services"
binding="basicHttpBinding" bindingConfiguration="SealingServicesBinding"
contract="sealing_services.SealingServices" name="SealingServices"
behaviorConfiguration="IrmSealingAbril">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="IrmSealingAbril">
<clientCredentials>
<clientCertificate storeLocation="LocalMachine"
storeName="Root"
x509FindType="FindByThumbprint"
findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX">
</clientCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="SealingServicesBinding" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Basic" realm="weblogic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
Where am I going wrong?
Additional information: The request apparently is correct as confirmed by oracle support. However, I can't get the returning response. I thought it could be something related to the IIS, but I do not have mush skill at configuring it.
Thanks in advance.
I found the answer for my problem here:
Error consuming webservice, content type "application/xop+xml" does not match expected type "text/xml"
Thanks anyway

javaee 5 bookstore sample to run with jboss 4.0 and hibernate

when i am trying to deploy bookstore1 web application from Netbeans ( JavaEE5 sample ) , i have changed the persistence.xml file to use hibernate :
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="book" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/BookDB</jta-data-source>
<class>com.sun.bookstore.database.Book</class>
</persistence-unit>
</persistence>
and my mysql-ds.xml file is :
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/BookDB</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/bookdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>1234</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
I am getting below error:
[STDOUT] Couldn't create bookstore database bean: null
19:16:53,846 INFO [[/bookstore1]] Marking servlet ShowCartServlet as unavailable
19:16:53,846 ERROR [[ShowCartServlet]] Allocate exception for servlet ShowCartServlet
javax.servlet.UnavailableException: Couldn't get database.
at com.sun.bookstore1.servlets.ShowCartServlet.init(ShowCartServlet.java:39)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
19:17:17,534 INFO [[ShowCartServlet]] Servlet ShowCartServlet is currently unavailable
Can you please let me know where i am making wrong...
JBoss 4.0.x is not a JavaEE5 appserver, it's much too old - it only supports J2EE 1.4
This may not be the problem (it's impossible to tell from the info you've given us), but there's no point continuing with the JavaEE5 sample and JBoss 4.0.x, it just won't work.
You either need to use the J2EE 1.4 sample app, or upgrade your JBoss (to version 5 or 6).