I'm using WSO2 API MANAGER version 1.10.0. I have a issue related Content-Length setting. there are two api.
one api have 411 error (required Content-Length)
then I set below property in passthru-http.properties file.
http.headers.preserve=Content-Length
after that 411 error solved. but another api occurring exception.
TID: [-1] [] [2016-12-23 16:11:18,946] ERROR {org.apache.synapse.transport.passthru.SourceHandler} - Content-Length header already present {org.apache.synapse.transport.passthru.SourceHandler}
org.apache.http.ProtocolException: Content-Length header already present
at org.apache.http.protocol.ResponseContent.process(ResponseContent.java:101)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:139)
at org.apache.synapse.transport.passthru.SourceResponse.start(SourceResponse.java:170)
at org.apache.synapse.transport.passthru.SourceHandler.responseReady(SourceHandler.java:193)
at org.apache.http.impl.nio.DefaultNHttpServerConnection.produceOutput(DefaultNHttpServerConnection.java:305)
at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection.produceOutput(LoggingNHttpServerConnection.java:114)
at org.apache.synapse.transport.passthru.ServerIODispatch.onOutputReady(ServerIODispatch.java:87)
at org.apache.synapse.transport.passthru.ServerIODispatch.onOutputReady(ServerIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:150)
at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:180)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:342)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586)
at java.lang.Thread.run(Thread.java:745)
As a result, the two APIs can not run concurrently due to Content-Length configuration.
ps.
I saw below url.
WSO2 API Manager 1.10 issue
I modified main.xml in /repository/deployment/server/synapse-configs/default/sequences folder
it's not working for me.
You can disable chunking globally by 2 methods.
1) Edit velocity template file and add this.
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
See this blog on how to do that.
2) Add a new mediation sequence. See this.
Related
UPDATE: We have reproduced the same problem connecting to EI 6.1.1 business process module
We are trying to implement a application registration (generation of key) for API manager (version 2.1.0), using BPS (version 3.6.0).
For this, we are following the instructions in
https://docs.wso2.com/display/AM210/Adding+an+Application+Registration+Workflow
We have also corrected a typo in the content of the package, as provide by the
https://github.com/wso2/product-apim/pull/2730/files#diff-737be153055f194110665b96252dcebe
The previous workflow (ApplicationCreation) works fine, but this, when we click in "GenerateKeys" in store, fails with error in BPS, saying that the action urn:approve is invalid
TID: [-1234] [] [2018-06-20 21:11:32,909] DEBUG {org.wso2.carbon.bpel.messagetrace} - Message received: ApplicationRegistrationWorkFlowProcess.{http://workflow.application.apimgt.carbon.wso2.org}initiate {org.wso2.carbon.bpel.messagetrace}
TID: [-1234] [] [2018-06-20 21:11:33,824] WARN {org.apache.axis2.addressing.AddressingFaultsHelper} - triggerActionNotSupportedFault: messageContext: [MessageContext: logID=11ff1a7f886692cdddf6394b6d5e88da06b8bac0e1095ec3] problemAction: urn:approve {org.apache.axis2.addressing.AddressingFaultsHelper}
TID: [-1234] [] [2018-06-20 21:11:33,830] ERROR {org.apache.axis2.engine.AxisEngine} - The [action] cannot be processed at the receiver. {org.apache.axis2.engine.AxisEngine}
org.apache.axis2.AxisFault: The [action] cannot be processed at the receiver.
We have checked, in BPS carbon console, that the service ApplicationRegistrationWorkFlowProcess is deployed, and the WSDL 1.1 endpoint is deployed with soapAction=urn:approve.
The endpoint in API Manager (store), the workflow-extensions in registry /_system/governance/apimgt/applicationdata/workflow-extensions.xml are modified as described to
<SandboxApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://apibps.example.com:9765/services/ApplicationRegistrationWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">admin</Property>
<Property name="callbackURL">https://apimanager.example.com:8243/services/WorkflowCallbackService</Property>
</SandboxApplicationRegistration>
I tested the same with APIM 2.2.0 and BPS 3.6.0 and EI 6.2.0. It worked fine. Can you change the port in callbackURL of SandboxApplicationRegistration in workflow-extensions.xml to 8248 and retry?
So i'm working on PER-API log configuration in WSO2, in order to log REQUEST/RESPONSE for an API call, we need to
Modify the file log4j.properties in < APIM HOME >\repository\conf by adding the following lines to it
log4j.appender.TestAPI_APPENDER=org.apache.log4j.RollingFileAppender
log4j.appender.TestAPI_APPENDER.File=${carbon.home}/repository/logs/PerAPI/${instance.log}/wso2-APILogs-service${instance.log}.log
log4j.appender.TestAPI_APPENDER.MaxFileSize=1000KB
log4j.appender.TestAPI_APPENDER.MaxBackupIndex=10
log4j.appender.TestAPI_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.TestAPI_APPENDER.layout.ConversionPattern=%d{ISO8601}
[%X{ip}-%X{host}] [%t] %5p %c{1} %m%n%n
log4j.category.API_LOGGER.admin--APINAME= TRACE,
TestAPI_APPENDER
It logs the following details to a .txt file which is pretty comprehensive and cool
However i do have some questions that i'm stuck in and would like help in, here are they
The HTTP Status Code for the response is not being logged here which i badly need, I've looked here and it says to use %s - HTTP status code of the response however when i put the character %s in the log4j.properties ConversionPattern, those characters are printed as they are, how can i achieve this?
Secondly, does wso2 has some sort of portal in order to visualize these custom logs?
Thirdly, i need to put a line at the end of request/response (4 entries per API CALL) log lines and i'm unable to find any solution, if i hardcode a line into the log4j.properties ConversionPattern, i suppose it would print after each entry, please help?!
Thank you
Please find the below answers for your questions
By enabling wire logs settings you can easily track the HTTP Status Code for the response. You can enable the header and wirelogs by un-commenting following lines in log4j.properties file (located at: \repository\conf)
log4j.logger.org.apache.synapse.transport.http.headers=DEBUG
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG
The third Question, you can achieve this by using log mediator in In-sequence(print a line in request) and out-sequence(print a line in response).For an example you can use custom log in your api synapse configuration file as follows (here I use this custom log in in sequence)
<sequence xmlns="http://ws.apache.org/ns/synapse" name="admin--TwitterSearch:v1.0.0--In">
<log level="custom">
<property name="test" value="your value goes here……….” />
</log>
</sequence>
You can enable wirelogs to track the request and responses of the API when it is getting invoked. To do that uncomment following line in log4j.properties file.
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG
Furthermore if you want to log the http messages you can uncomment following line as well.
log4j.logger.org.apache.synapse.transport.http.headers=DEBUG
In WSO2 API Manager Analytics, a log Analyzer is included. You need to configure WSO2 API Manager Analytics with WSO2 API Manager to get that.
If you want to print a customized log for the API, you can use the Log mediator and add a Log mediator as a mediation extension per API with the required log to be printed in the synapse configuration of the API.
Having WSO2 5.0.0 trying to implement the store and forward pattern with a JDBC message store.
Sending a message to the target endpoint throws an exception:
TID: [-1234] [] [2016-12-05 23:25:24,874] ERROR {org.apache.synapse.message.processor.impl.sampler.SamplingService} - Error occurred while executing the message {org.apache.synapse.message.processor.impl.sampler.SamplingService}
org.apache.synapse.SynapseException: Unexpected error during sending message out
at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:257)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:84)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:548)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:382)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:55)
at org.apache.synapse.mediators.builtin.CallMediator.handleNonBlockingCall(CallMediator.java:221)
at org.apache.synapse.mediators.builtin.CallMediator.mediate(CallMediator.java:99)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.message.processor.impl.sampler.SamplingService$1.run(SamplingService.java:211)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:538)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:78)
... 15 more
I believe I am missing an important transport, Axis2 or Synapse property, but I am unable to find which one.
Sequences to store and forward are here.
I was trying to find out in the source codes what could be causing the NullPointerException, but for me it makes no sense as the httpMethod and messageType is defined.
Thank you all for any hint
Edit:
based on a comment, the Synapse source in use is here.
Where is your Message Processor here? Ideally your Message Processor should call the backend service using the call mediator. Can you please try out the steps as below.
Create a proxy service to accept messages and store them in your JDBC store using the store mediator inside that.
Then create a Scheduled Message Forwarding Processor which listens to the above JDBC store and forwards messages to the endpoint. If you need you can specify any reply sequence. Otherwise make sure you set following property inside your proxy service above. <property name="OUT_ONLY" value="true" />
If you still can not figure out the error get the wire logs by enabling the log4j.logger.httpclient.wire.header=DEBUG
log4j.logger.httpclient.wire.content=DEBUG in log4j.properties file and post it here so that I can analyze and help you out.
If you need guaranteed delivery, you have to use the Message Forwarding processor. Sampling processor is used to implement throttling related usecases which may lead to message loss.
For more information please refer the article [1]. Don't use the same synapse configuration since it is bit obsoleted, instead create artifacts using ESB web interface or developer studio. Otherwise you may run into different errors due to missing configurations.
[1] http://wso2.com/library/articles/2014/01/guaranteed-delivery-with-Message-Store-Message-Processor%20/
I have a webservice with some input only operations. In the ESB i've created a proxy and sets the properties OUT_ONLY and FORCE_SC_ACCEPTED to true. Everytime I call the proxied operation I get the following error message in the wso2carbon.log:
TID: [0] [ESB] [2015-04-02 09:52:45,307] ERROR {org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception {org.apache.axis2.transport.base.threads.NativeWorkerPool}
java.lang.UnsupportedOperationException: Not yet implemented
at org.apache.axis2.description.OutOnlyAxisOperation.getMessage(OutOnlyAxisOperation.java:124)
at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.processResponse(MultitenantMessageReceiver.java:125)
at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.receive(MultitenantMessageReceiver.java:81)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Althought everything seems to work OK, I am worried about this message. What am I doing wrong. These input only will be called very frequently in production, so I'd like them to be error free.
WSO2 ESB: 4.8.1
Thanks,
Danny
this exception will occur if OUT_ONLY=true and your backend sending a response back to the esb.if OUT_ONLY is set true, your are getting a response from the backend then it is not a valid scenarion for if OUT_ONLY property.check this post[1]
1.https://mohanadarshan.wordpress.com/2013/05/05/out_only-scenario-in-proxy-service-wso2-esb/
Out-only property is set to inform that this service does not return a response back. For instance if you are sending messages to a message broker. Force-sc-accepted flag causes ESB to send HTTP Accepted status response back to the client (which calls ESB) since otherwise client will timeout without a reaponse. So please make sure your backend service does not send a response and it is accessible to ESB.
Solved this issue for now: My ESB was running in multi-tenant mode. The proxy service were created in the tenant. I did a fresh install and put the config in (so no tenants). The error disappears immediately. When I remove the config and create a tenant and put the config into the tenant the error reappears. So might this be a bug. I can try to verify with running sample 253 (OneWayProxy) in a tenant.
I want to proxy RemoteUserStoreManagerService (exposed on WSO2 IS) over WSO2 ESB.
When I call getUserClaimValuesForClaims operation I get the response. I tested the WSO2 IS (connected to my Active Directory) for performance. I sent requests in 100 threads (each thread with 250ms delay) and it gave me an average response of 250ms (which is ok for me).
So I proxied the getUserClaimValuesForClaims operation using the Transformation proxy and it also worked. But during the performace testing (with the same or smaller load) I have got following errors and not all the messages have returned (on average 1 of 100 messages).
[2014-01-06 19:28:21,047] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:d2b85c03-beaf-409b-bf39-2e8143bd9e0b, Direction: response
[2014-01-06 19:28:38,441] ERROR - SourceHandler I/O error: An established connection was aborted by the software in your host machine
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:202)
at sun.nio.ch.IOUtil.read(IOUtil.java:175)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:243)
at org.apache.http.nio.reactor.ssl.SSLIOSession.receiveEncryptedData(SSLIOSession.java:348)
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:376)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady
[2014-01-06 19:29:14,051] WARN - TargetHandler http-outgoing-66: Connection time out while in state: REQUEST_DONE
[2014-01-06 19:29:14,061] WARN - EndpointContext Endpoint : AnonymousEndpoint will be marked SUSPENDED as it failed
[2014-01-06 19:29:15,041] WARN - EndpointContext Suspending endpoint : AnonymousEndpoint - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Mon
[2014-01-06 19:29:14,451] WARN - SourceHandler Connection time out after request is read: http-incoming-57
I thing that it says, it timeouts on backend; but I get the response logged in faultSeuence.
I noticed that the problem is caused by the XSLT mediator in proxy implementation, because when I removed the xslt mediators the log is empty. I tried xquery and it was the same. Even the log mediator in outSequence causes this issues.
Here is my final Proxy.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="GetUserProxy" transports="https http" startOnLoad="true" trace="disable">
<target>
<endpoint>
<address uri="https://localhost:9443/services/RemoteUserStoreManagerService.RemoteUserStoreManagerServiceHttpsSoap12Endpoint/"/>
</endpoint>
<inSequence/>
<outSequence>
<log/>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
When I remove the log mediator, the WARN messages disapears from log and ALL response messages are returned to SoapUI.
Could anybody tell me why it behaves this way?
Thank you very much.
David
RemoteUserStoreManagerService is an admin service. Therefore, you need to send Identity Server's user name/password in a basic authentication header or session cookie. I can not see setting of authorization headers in your proxy configuration such as following
<property expression="fn:concat('Basic ', base64Encode('username:password'))" name="Authorization" scope="transport"></property>
More details would be here. Also you need to create a message body to send to the "RemoteUserStoreManagerService" and read the response messages. These must be implemented using ESB configuration. However, you can write an custom ESB mediator to do this also. Sample java code to call this service can be found here. You can find the detail on writing custom mediator from here
We have figured out, that the problem is probably more general and doesn't relate only to WSO2 IS, because we have the same problem when similating the WSO2 IS service as SoapUI mock.
The problem is probably in HTTP-passthru transport in axis configuration, because when we switched to HTTP-NIO the problem disapears and it is even faster.
There is a post about performance tunnig that helped us.
Howevever, I would like to know what transport we should use in production or where the problem is. Because now it seems that we cannot use HTTP-passthru transport for production environment.
Is anyone experiencing this problem?
what are the versions of ESB and IS your working with..?
try to restart the ESB and call the Service again. Do remember call to Identity server is a secure call.