cxf LOGGING of soap messages - reduce payload - delete binaryStreamList WildFly - apache

Actually i have a problem with Webservice-Framework Apache CXF Integration/Intstalling in WildFly v.10 - org.apache.cxf.
Every SOAP message is logged in a special file soap.log. This is configured in standalone.xml of JBoss. The Problem is that the logged SOAP messages contains <-binaryStreamList><-bytes>...<-bytes> - Base64 Data - which is too much (unuseful and unreadble information). How can i disable the logging of Base64 crypted data in the <-binaryStreamList> section of logged SOAP messages?
EXAMPLE OF logged SOAP Message:
Payload: <-soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><-soap:Body><-raum>TEST<-/raum><-clientU
ser><-System><-/clientUser><-nummer>99999<-/nummer><-kNumber>9111111<-/kNumber><-nameOfFile>test.pdf<-/nameOfFile>
<-binaryStreamList>
<-bytes>JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9TdWJ0e
XBlL1R5cGUxL1R5cGUvRm9udC9CYXNlRm9udC9IZWx2ZXRpY2EvRW5jb2RpbmcvV2luQW5zaUVuY29kaW5nPj4KZW5kb2JqCjIgMCBvYmoKPDwvTW9kRGF0ZShEOjIwMTcwNzA1MTM1MDM5KzAyJzAwJykvQ3JlYXRpb25EYXRlKEQ6
MjAxNzA3MDUxMzUwMzkrMDInMDAnKS9Qcm9kdWNlcihpVGV4dK4gNS41LjYgqTIwMDAtMjAxNSBpVGV4dCBHcm91cCBOViBcKEFHUEwtdmVyc2lvblwpOyBtb2RpZmllZCB1c2luZyBpVGV4dK.....<-bytes>

Related

Mule 4: Call SOAP Service with attachment

How can I send the multipart request without Mtom enable in Mule 4 by Web Service consumer connector?
This is content of attachment:
<ee:set-variable variableName="AddAttachmentReq" ><![CDATA[%dw 2.0
output application/java
---
{
"TestImage.JPG": readUrl("https://savannahw2.sg-host.com/wp-content/uploads/2020/02/image-24.png", 'application/octet-stream')
}
]]></ee:set-variable>
Case1: Disable MTOM (I catch the request in SoapUI mockup Service)
I can't see the attachment file: The base64 of attachment is inline the soap:Body.
I got the response error message:
AddDocument : Specified File: TestImage.JPG not found.
Disable MTOM
Case2: Enable MTOM
I can see the attachment file.
But Mtom enable auto adjust code in the soap body:
<TestImage.JPG>
<xop:Include href="cid:TestImage.JPG" xmlns:xop="http://....
</TestImage.JPG>
I got the response error message:
org.apache.axis2.databinding.ADBException: Unexpected subelement {http://....com/AddDocServiceImp/}TestImage.JPG
Mtom Enable
I need send the request like this:
SOAPUI Request
The WSDL had no element for contain the content of attachment like: content, binaryAttachment, attachments,...
UPDATE
I had resolve this issue by using HTTP Request component to mimic WSC consume operation.
Link: Workaround for various issues with Mule 4 Web Service Consumer Connector

Hosting the endpoint in the BizTalk process using non UTF-8 encoding

There is a problem with encoding using WCF detailed described here : blog post
WCF: Text Message Encoding and ISO-8859-1 Encoding
I'm getting similar error in response :
A message sent to adapter "WCF-BasicHttp" on send port "XXXX" with URI "http://XXXXXXXX:8080/index.php" is suspended.
Error details: System.ServiceModel.ProtocolException: The content type text/xml; charset=ISO-8859-1 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.
I'd like to create a simple proxy WS in BizTalk Environment. I created 1 Receive Location using WCF-BasicHttp / WCF-Custom (neither worked) adapter and send port (SOAP WCF-BasicHttp). Send port is subscribing Receive Location as mentioned here:
Best approach to simple proxy on BIZTALK
I created endpoint in the BizTalk process mentioned here: Codit Blog Hosting WCF HTTP receive location inside BizTalk, without using IIS.
I cannot set other textEncoding than UTF-8, while trying to set ISO-8859-1 I get the error:
"The text encoding ISO-8859-1 used in the text message format is not supported. Parameter name: encoding"
Is there any way to run this using some custom encoders in BizTalk environment?
I managed to do it myself.
I deleted textMessageEncoding binding from Receive and Send WCF-Custom adapter
and instead of it I put customMessageEncoder binding with soap11 and proper iso encoding. Note that httpTransport should be last on binding list.

Logging information appearing in Response

I am calling json api built using Symfony2 using LAMP stack.
URL for api is like
http://ab.ab.com/new/358342/17/12.948468/77.718571
Response I get back correctly:
{"Result":{"statusCode":1,"statusMsg":"Created Successfully"}}
However http headers contain the information I am logging in server. Example is
-wf-1-1-1-3:185|[{"Type":"INFO","File":"","Line":"","Label":"app"},"Data From Publisher Device Id:358342045834581 Route Id: 17 Lat:12.948468 Lng77.718571 Timestamp:2014-09-18 13:23:20 Data:tstsst|S-1"]|
Above logging info is coming back in Http header of response.
How should I disable the server logging info coming back.
Finally I figured it out.
I was using firephp handler and firephp adds the logging information back in response through http headers.
firephp is useful tool for debugging json apis, however should be disabled in production to avoid revealing sensitive information.
I switched to fingers_crossed handler.

WSO2 API Manager is not responding to a request that returns zip file (application/octet-stream)

Using WSO2 API Manager 1.3.1. Trying to use the API Manager to proxy to a REST service. I have set up the service in API Mgr and can successfully post and get responses, typically json, though some are text.
However, when I try to GET a resource that returns binary content (a zip "file", content-type:application/octet-stream), the API Manager does not seem to respond and I can see an error in the console window (i'm running wso2server.bat in console):
[2013-07-03 11:52:05,048] WARN - SourceHandler Connection time out
while writing the response: 173.21.1.22:1268->173.21.1.22:8280
I have an HTTPModule on my internal service and it seems to be responding with the appropriate content (I can see the GET and response data logged). I can also call to the internal service directly and get a response, so that end of things seems OK. But going through the API Manager seems to fail.
I found information on enabling other content-types:
WSO2 API Manager - Publishing API with non-XML response
http://wso2.com/library/articles/binary-relay-efficient-way-pass-both-xml-non-xml-content-through-apache-synapse
Using that information I tried to enable the application/octet-stream for messageFormatter and messageBuilder using the binary relay and it did not help (or seem to make a difference). I have even disabled all other content-types and use the binary relay for all content-types and it does not help.
Currently, I'm running with just the following in both axis2.xml and axis2_client.xml (in their appropriate sections):
<messageBuilder contentType=".*" class="org.wso2.carbon.relay.BinaryRelayBuilder"/
<messageFormatter contentType=".*" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
I still get my json and text responses, but WSO2 times out getting the zip content. I saw the JIRA referenced in axis2.xml about enabling the ".*" relay, but as the other requests seem to work, I'm not sure it's an issue for me. I did try adding
'format="rest"' to the API definition, but it seemed to break all operations even the ones that worked prior so I've pulled it back out.
Any ideas on what is happening or how to dig in and debug this will help. Thanks!
After working with this for much too long, it turns out that my WSO2 configuration was correct, using the Message Relay and BinaryRelayBuilder, etc. While my REST service could reply immediately, I was setting a HTTP header that I assume WSO2 does not like, because when i removed it WSO2 would reply at an expected rate (instantly).
I was setting the header:
Transfer-Encoding: binary
When I removed that header from my service reply, then WSO2 operated as expected. I don't know if that's a "bug" in WSO2 or if I was implementing incorrectly, but I do have what seems like a "workaround" by omitting that header from my service response.

Spring Integration: How to send response packet to client in case of exception using error-channel?

I am using Spring Integration in my project.
Endpoints used in application are in-bound gateway, header based router, transformer, spliter, service activator.
In case of success flow(not any exception), in-bound gateway reply-channel getting desired response and client gets that response which is fine but in case of any exception, I want to send customized error response which is not working as per my requirement.
I am using error-channel to accomplish above requirement but not succeeding in that.
Please find my configuration of in-bound gateway, error channel etc.
I have not use any chain in configuration.
<int-http:inbound-gateway id="inboundGateway"
supported-methods="GET, POST" request-channel="requestChannel"
path="/services/tylv/{requestParam}" reply-channel="responseChannel"
error-channel="errorChannel">
</int-http:inbound-gateway>
<int:transformer ref="errorHandler"
input-channel="errorChannel" method="generateErrorResponse"
output-channel="responseChannel" />
<bean id="errorHandler"
class="com.csam.wsc.enabling.integration.transformer.ErrorHandler" />
In case of exception , com.csam.wsc.enabling.integration.transformer.ErrorHandler.generateErrorResponse(ErrorMessage) successfully called.This API handle exceptions, generate Error Response Packet but it is not being sent to client, just only HTTP Status Code 200 sent.
Ideally it should be sent because transformer's output-channel is reply-channel of inbound-gateway which is already sending response packet along with status code 200 in case of success (no any exception).
I think in case of error-channel , in-bound gateway reply-channel is not working, but I am not sure.
Please help me in configuring error-channel.
You should store the message's headers before the error reaches the error channel and then you should create a new message with the stored headers and route that new message to response channel.
MessageBuilder.fromMessage(errorResponseMessage).copyHeadersIfAbsent(storedHeaders).build();