CXF Soap request/response - cxf

i have two interceptor(AbstractSoapInterceptor) that handle in and out messsage.
I would to correlate this message in some way, but don't now how.
I think that there is an information on who do the request into SOAP message response but i can't found it.
Can someone help me?
Tnks

CXF will handle that for you. The message has a "getExchange()" method on it that holds the exchange that would be common for both the request and the response. Any data that you need to hold between the in and out can be stored/retrieved there.

Related

Camel netty4-http client handling of http 100-Continue

We are using netty4-http as a client and have a problem when the server side answers with a http 100-Continue.
I expected the client to handle that internally and continue the call but it's actually returning http 100.
The test org.apache.camel.component.netty4.http.NettyHttpClientExpectContinueTest in the Camel code seems to test exactly that situation but it's ignored with the comment "TODO Fix it, need to send the response back". So I guess it has been a plan to implement it.
I'm new too Netty I wondering if it's possible to handle that in the Netty pipeline by overriding the ClientInitializerFactory (I found out it's the HttpObjectAggregator that returns 100)?
So any help how do achieve that in the Netty pipeline or any tips how to achieve that in some other way is welcome.

Sending immediate response and detailed message in DialogFlow

I have a requirement of sending two messages from my chatbot. The first message will be send immediately as a response like "please wait for a moment" and the second one will be sending after an API call.
I'm using Dialogflow with Facebook messenger. Is it possible in Dialogflow send an immediate message and later send a detailed one?
No, you can't send two responses asynchronously. You could show two simple responses but those would be sent at the same time.
app.ask(app.buildRichResponse()
.addSimpleResponse('This is the first')
.addSimpleResponse('and this is the second')
);
I don't know a way to give two responses to the user at different times, but as an alternative, you can give a default response to the user along with the fulfillment response in case something goes wrong on the server side like
Bot: Something went wrong.. please check your internet connection or try again after some time.

Connection state with libmicrohttpd and http 102

What I am trying to achieved is:
Send http 102 to client who requested somedoc.html
Some processing on the side including out of band authentication
If authenticated, send response built from somedoc.html, otherwise generic not auth message
I'm having a failure of understanding somewhere, in that I cannot seem to figure out how to send the 102 and save the connection details so that I can forward the response in step 3. I had thought I could queue a response then either enter a wait loop or suspend the connection, but as far as I can tell I have to return from the MHD_AcceptPolicyCallback for the response to be sent, then I cannot figure out how to get back to the connection. I have looked at the request completed call back but this still results in the 102 not being sent.
I really can't figure out a process to achieve these steps from the examples or the manual and any help would be appreciated.
HTTP standards doesn't define response code 102.
See https://www.rfc-editor.org/rfc/rfc7231#section-6
and https://www.rfc-editor.org/rfc/rfc2616#section-6.1.1
HTTP protocol use request-response logic. If you already responded to some request then you can't add another response later to the same request.
After talking with the developer, the 102 status code was defined "for completeness"; however, no attempt has been made to implement the required functionality to actually be able to use this status code in a meaningful way on a server developed with the libmicrohttpd library.

Salesforce send Outbound Message as PUT

I am sending outbound messages from Salesforce. They are always sending as POST, though. Is there a way to change the method they are using?
I'd like to send some of them as PUT, instead (and, eventually, some DELETE). I'm not finding anything from Google searches.
Outbound Messages are SOAP 1.1 based, and as such are required to use POST by the SOAP 1.1 spec, so there are no options to use other HTTP methods for the Outbound Message requests.
If you want to send HTTP requests instead of SOAP messages, you'll need to write an Apex trigger and use a future method to make the HTTP request from apex.

Force.com callout: Is there a way to get the full response from the target server

When calling a web service from Force.com, I am getting:
System.CalloutException: Web service callout failed: Unexpected
element. Parser was expecting element
'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'
The network guys at the other end has asked to see the full response that Salesforce is getting from their server.
Is there a way to achieve that? I have tried running with debug level 'Finest' from execute anonymous, but that yields the same little message with no further detail.
The message you are getting is because an error is generated as Saleforce is trying to parse the response is and it isn't logged unfortunately.
The parsing error is happening because instead of a SOAP message response you are getting an HTML page. This usually happens when you are accessing a service that is protected behind a firewall. Which means you may be able to see the service when browsing on your computer but remember that Salesforce is outside of your firewall and thus any communication by Salesforce to your service will be blocked.
Couple of ways to address this but this wiki topic from Salesforce best covers the options:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_om_outboundmessaging_security.htm
The above is specific to outbound messaging but essentially the technology issues are the same.
Don't forget that Apex includes an HttpRequest Class that works as a lower layer than the SOAP APIs. You should be able to write up a test method that sends a hard-coded XML request to the server and dumps the HttpResponse so you can see it.
Adding my own best answer, based on some internet research:
You can use an external tool like Runscope as a webservice proxy to automatically forward requests and pass through responses and view the XML SOAP messages. This is not a native solution on SFDC but it does do the job.
https://www.runscope.com/
The issue is that Force.com is trying to parse a SOAP response that's actually just HTML. This happens sometimes when an error occurred server-side and the response is meant for a browser to display, rather than sending back an exception report via a properly formatted SOAP response.
If they can't figure out why they are not sending back a consumable SOAP response, then you can try using other tools (outside of Force.com) to make the same webservice call from your browser and then see what the HTML actually says on return.

Resources