Wednesday, November 12, 2014

How to disable schema validation in JAXB


Following steps helps in disabling schema validation in JAXB when SOAP response is received from SOAP web service call.

In Spring configuration file for each jaxws:client for which schema validation to be disabled, add the following element in jaxws:properties


<entry key="set-jaxb-validation-event-handler" value="false"/>

e.g

    <jaxws:client id="serviceSoa" serviceClass="com.koushik.enterprise.services.ServiceSoa"
        address="url of service" username="username" password="password">
            <jaxws:properties>
                <entry key="set-jaxb-validation-event-handler" value="false"/>
            </jaxws:properties>
    </jaxws:client>

Wednesday, March 12, 2014

Installing Postman Rest Client Proxy on Chrome/Mac OS


Google Chrome Postman RESTClient overrides the following headers when sending request to server
Ref: https://github.com/a85/POSTMan-Chrome-Extension/wiki/Postman-Proxy

Accept-Charset
Accept-Encoding
Access-Control-Request-Headers
Access-Control-Request-Method
Connection
Content-Length
Cookie
Cookie 2
Content-Transfer-Encoding
Date
Expect
Host
Keep-Alive
Origin
Referer
TE
Trailer
Transfer-Encoding
Upgrade
User-Agent

Via

To send these header information to server from Postman using Chrome, install Postman Proxy 
Steps:
  1. Go to Postman settings (top right corner) and enable the Postman Proxy option
  2. Download this Python script - https://raw.github.com/a85/POSTMan-Chrome-Extension/master/proxy/proxy_server.py
  3. Make sure you have Twisted installed - http://twistedmatrix.com/trac/wiki/Downloads
  4. Run the proxy server using - python proxy_server.py. By default the server runs on 8000 and only works for HTTP protocols at the moment. If following error is shown
      File "proxy_server.py", line 5, in <module>
         from ImageFile import Parser


      then comment line 5 in proxy_server.py, as a work around. This is due to unavailability of ImageFile.

When you run this script, it'll be listening on port

5. Set proxy URL "localhost:8090"(Note that if 8090 port is already used in your system, you have to choose another unused port) as the proxy inside your operating system. All HTTP calls in your OS will go through the OS so make sure you are only using it while you are testing your API.
In Mac set the Proxy URL as follows:

Apple Menu --> System Preferences --> Network --> select the connected Network (Ethernet/Wifi etc..) --> Advanced --> Proxies --> Web Proxy URL
Now enter the host name as "localhost" and port as "8090", again make sure the port is not already used.