maxBuffer length exceeded error on the imagemagick identify method - imagemagick

I try to identify a pdf of 200 pages with imagemagick but its gives me a error ' maxBuffer length exceeded'
i tried to change my policy file
i use the newest imagemagick
i have installed ghostscript for the pdf
<policymap>
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<policy domain="resource" name="memory" value="14GiB"/>
<policy domain="resource" name="map" value="30GiB"/>
<policy domain="resource" name="width" value="16MP"/>
<policy domain="resource" name="height" value="16MP"/>
<policy domain="resource" name="area" value="40GB"/>
<policy domain="resource" name="disk" value="100GiB"/>
<!-- <policy domain="resource" name="file" value="768"/> -->
<!-- <policy domain="resource" name="thread" value="4"/> -->
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<policy domain="resource" name="time" value="99999999999999999999999999999999999999"/>
<!-- <policy domain="system" name="precision" value="6"/> -->
<!-- not needed due to the need to use explicitly by mvg: -->
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
<!-- use curl -->
<policy domain="delegate" rights="none" pattern="URL" />
<policy domain="delegate" rights="none" pattern="HTTPS" />
<policy domain="delegate" rights="none" pattern="HTTP" />
<!-- in order to avoid to get image with password text -->
<policy domain="path" rights="none" pattern="#*"/>
<policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
</policymap>
maybe i forgot something or another policy i need to add i hope i have given enough information that someone can help me with this because it gives me a headache.
thanks in advance

Related

XmlValidate in ant with namespace

How can i validate these xml and xsd file with xmlvalidate task with Ant . i have tried but didn't get solution for it .can i get a solution
<property name="doc.xsd" location="${basedir}/test.xsd" />
<target name="FindDesc" >
<xmlvalidate file="ab.xml" lenient="yes" failonerror="yes" warn="yes">
<fileset dir="${basedir}" includes="ab.xsl" />
<attribute name="http://xml.org/sax/features/validation" value="true"/>
<attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
<property name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" value="${doc.xsd}" />
</xmlvalidate>
</target>
ab.xml file
<?xml version="1.0"?>
<books xmlns="http://www.example.org/Test" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="test.xsd">
<book id="bk001">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<price>44.95</price>
<pub_date>2000-10-01</pub_date>
<review>An amazing story of nothing.</review>
</book>
<book id="bk002">
<author>Poet</author>
<title>The Poet's First Poem</title>
<genre>Poem</genre>
<price>24.95</price>
<review>Least poetic poems.</review>
</book>
</books>
test.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="http://www.example.org/Test"
>
<xsd:element name="books" >
<xsd:complexType >
<xsd:sequence>
<xsd:element name="book" maxOccurs="unbounded" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float" />
<xsd:element name="pub_date" type="xsd:date" />
<xsd:element name="review" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
i have tried to test xml with xsd schema with Ant Script i get its not working as mine i get error like this
cvc-elt.1: Cannot find the declaration of element 'books'.
and with these
TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'http://www.example.org/Test'.
xml with no namespace but i want to try to validate with namespace through ant script ..
what can i do if there is any error please give suggestion to test these xml and xsd file with ant script i have gone through xml validation and schema validation
we can use SchemaValidation its easy and fast way to validate the xml with xsd file
If there is one file we can go through this
<schemavalidate>
<schema namespace="<schema_nameSpace>">
file="abc.xml"/>
</schemavalidate>
If multiple file is there we can use fileset
<schemavalidate warn="true" failonerror="true" fullchecking="true">
<fileset dir="<Src_dir_for_Xml>">
<include name="*.xml" />
</fileset>
<schema namespace="<Your schema name space>" file="<schema_src_dir_For_schema" />
</schemavalidate>

WSO2 ESB - Consume a OAuth2 Service

I'm tying to call an OAuth token service to retrieve the token.
Below is my proxy. This is a simple rest endpoint call which retrieves the token. For testing purpose I'm trying to log the token in the response.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="sla_proxy_svc_vo2" startOnLoad="true" trace="disable"
transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="custom">
<property name="msg" value="*****INITIATING*****" />
</log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:echo="http://echo.services.core.carbon.wso2.org"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<nstxt:text xmlns:nstxt="http://ws.apache.org/commons/ns/payload">grant_type=client_credentials&client_id=G6Dk_3ZdrXOfPiuctufVq6GfTWoa&client_secret=jxA8NTkEClE5xGUvGvvhVTDyXM4a</nstxt:text>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args />
</payloadFactory>
<log level="custom">
<property name="msg" value="*****BEFORE TOKEN SERVICE CALL*****" />
</log>
<log level="full" />
<property name="HTTP_METHOD" scope="axis2" type="STRING"
value="POST" />
<property name="messageType" scope="axis2" type="STRING"
value="text/plain" />
<property name="ContentType" scope="axis2" type="STRING"
value="text/plain" />
<property name="Accept" scope="axis2" type="STRING"
value="application/json" />
<send>
<endpoint>
<http format="rest" method="post" trace="disable"
uri-template="http://10.236.70.9:8281/token" />
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="custom">
<property name="msg" value="******OUT SEQUENCE*******" />
</log>
<log level="full" />
<send />
</outSequence>
<faultSequence />
</target>
</proxy>
I'm getting the below response when I call.
DEBUG {org.apache.synapse.transport.http.wire} - << "HTTP/1.1 415 Unsupported Media Type[\r][\n]" {org.apache.synapse.transport.http.wire}
DEBUG {org.apache.synapse.transport.http.wire} - << "X-Frame-Options: DENY[\r][\n]" {org.apache.synapse.transport.http.wire}
DEBUG {org.apache.synapse.transport.http.wire} - << "X-XSS-Protection: 1; mode=block[\r][\n]" {org.apache.synapse.transport.http
Will be please if anyone can guide me of I'm doing anything wrong here.
I was able to call the service with the following payload.
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<root>
<grant_type>client_credentials</grant_type>
<client_id>G6Dk_3ZdrXOfPiuctufVq6GfTWoa</client_id>
<client_secret>jxA8NTkEClE5xGUvGvvhVTDyXM4a</client_secret>
</root>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args />
</payloadFactory>
Also had to add the content type as below.
<property name="messageType" scope="axis2" type="STRING" value="application/x-www-form-urlencoded" />
<property name="ContentType" scope="axis2" type="STRING" value="application/x-www-form-urlencoded" />
This worked and retrieved the token.
Here is a template I'm using in a component to set the oAuth token, you could probably adapt it a bit for your case (sounds like you do not need grantType or user credentials)
<?xml version="1.0" encoding="UTF-8"?>
<template name="getToken" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="tokenURL"/>
<parameter name="clientId"/>
<parameter name="clientSecret"/>
<parameter name="grantType"/>
<sequence>
<property description="Base64 crendetials" expression="base64Encode(fn:concat($func:clientId,':',$func:clientSecret))" name="credentials" scope="default" type="STRING"/>
<property description="Authentication" expression="fn:concat('Basic ', get-property('credentials'))" name="Authorization" scope="transport" type="STRING"/>
<header name="Content-Type" scope="transport" value="application/x-www-form-urlencoded"/>
<property name="messageType" scope="axis2" type="STRING" value="application/x-www-form-urlencoded"/>
<property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
<property expression="$func:tokenURL" name="uri.var.authUrl" scope="default" type="STRING"/>
<property expression="$func:grantType" name="uri.var.grantType" scope="default" type="STRING"/>
<call blocking="true">
<endpoint>
<http method="post" uri-template="{uri.var.authUrl}?grant_type={uri.var.grantType}"/>
</endpoint>
</call>
<property expression="json-eval($.access_token)" name="OAuth_Token" scope="default" type="STRING"/>
<property action="remove" description="Remove Headers" name="TRANSPORT_HEADERS" scope="axis2"/>
<property description="Authorization" expression="fn:concat('Bearer ',get-property('OAuth_Token'))" name="Authorization" scope="transport" type="STRING"/>
</sequence>
</template>

Make a request application/x-www-form-urlencoded using wso2 esb

I trying to retrive a token OAuth2. But I don't khnow how I can make a x-www-form-urlencoded request using wso2esb.
This is a snippet of my code:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="test-oauth_v1" xmlns="http://ws.apache.org/ns/synapse">
<in>
<property name="RESPONSE" scope="default" value="true"/>
<property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>
<header action="remove" name="To"/>
<property name="messageType" value="application/json" scope="axis2" type="STRING"/>
<property name="basicAuth" scope="default" type="STRING" value="Z3FZVFhUQnhkQlVGNDloblxxzedtSGRBQ1kySWpmSmNvZXdh"/>
<script language="js"><![CDATA[
var body = {};
body.grant_type = 'password';
body.username = 'xxxx';
body.password = 'xxxxxxx';
mc.setPayloadJSON(body);
]]></script>
<property name="messageType" scope="default" type="STRING" value="application/x-www-form-urlencoded"/>
<header
expression="fn:concat('Basic ', get-property('basicAuth'))"
name="Authorization" scope="transport" xmlns:ns="http://org.apache.synapse/xsd"/>
<call>
<endpoint key="server_token_oauth"/>
</call>
<send />
</in>
</sequence>
Would you have any propositions ?
Best regards
You can refer this example [1]. Scope of the messageType should be axis2.
<property name="messageType" value="application/x-www-form-urlencoded" scope="axis2" type="STRING"/>
<property name="DISABLE_CHUNKING" value="true" scope="axis2" type="STRING"/>

Spring MVC resource Configuration issue

I have been using spring MVC for while and so far so good. I decided to add jquery UI to my project because I wanted to use jqgrid for my grids. below is the folder structure for the webapp:
-assets
+javascript
+images
-css
+jqgrid
+bootstrap
-jquery
-ui-smoothness
+images
jquery-ui-1.10.3.custom.min.css /** this file is referecing images in the image folder above with the css url() method **/
jquery_{versions}.js
-WEB-INF
+views
spring_application_Contexts.xml
web.xml
In my spring_application_context for mvc i have :
<mvc:resources mapping="/images/**" location="/assets/images/" />
<mvc:resources mapping="/styles/**" location="/assets/css/" />
<mvc:resources mapping="/script/**" location="/assets/js/" />
I can access my files in jsp using this :
<title><spring:message code="dataview.page.title" /> </title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link href="<spring:url value="/styles/bootstrap/bootstrap.css"/>/" rel="stylesheet">
<link href="<spring:url value="/styles/bootstrap/bootstrap-responsive.css"/>/" rel="stylesheet">
<link href="<spring:url value="/styles/jquery/ui-smoothness/jquery-ui-1.10.3.custom.min.css"/>/" rel="stylesheet">
<link href="<spring:url value="/styles/jqgrid/ui.jqgrid.css"/>/" rel="stylesheet">
<script type="text/javascript" src="<spring:url value="/script/jquery/jquery-1.9.1.min.js"/>"></script>
<script type="text/javascript" src="<spring:url value="/script/jqgrid/jquery.jqGrid.min.js"/>"></script>
<script type="text/javascript" src="<spring:url value="/script/jqgrid/grid.locale-en.js"/>"></script>
<script type="text/javascript" src="<spring:url value="/script/bootstrap/bootstrap.js"/>"></script>
but it complains about files not found like below:
Images url in firebug are of types:
http://localhost:8080/edowmis/styles/jquery/ui-smoothness/jquery-ui-1.10.3.custom.min.css/images/ui-bg_flat_75_ffffff_40x100.png
the images url contains the jquery ui css path.
where is the catch? Kindly help me address this it's something iv'e tried to figure out but in vain
Thanks
EDIT: adding web.xml and some important application context files
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>edowmis</display-name>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>edowmis</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/edowmis-config.xml</param-value>
</context-param>
<servlet>
<servlet-name>edowmisDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/edowmis-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>edowmisDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--Shiro -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Shiro End -->
</web-app>
snippet of main applicationcontext file edowmis-config.xml
<context:component-scan base-package="net.publichealth.edowmis.web.forms"/>
<context:component-scan base-package="net.publichealth.edowmis.web.security"/>
<context:component-scan base-package="net.publichealth.edowmis.web.util"/>
<context:component-scan base-package="net.publichealth.edowmis.web.service"/>
<import resource="classpath:META-INF/edowmis-mongo-config.xml" />
<import resource="edowmis-security-config.xml" />
<import resource="edowmis-config-mvc.xml" />
bellow is main part of mvc context:edowmis-config-mvc.xml
<mvc:annotation-driven/>
<context:annotation-config/>
<context:component-scan base-package="net.publichealth.edowmis.web.controllers"/>
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/mvc/views/" />
<property name="suffix" value=".jsp"/>
</bean>
<mvc:resources mapping="/images/**" location="/assets/images/" />
<mvc:resources mapping="/styles/**" location="/assets/css/" />
<mvc:resources mapping="/script/**" location="/assets/js/" />
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:messages</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
<bean id="messageConverters"
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="messageConverters">
<list>
<!-- Message converters -->
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
<bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/>
<bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
</list>
</property>
</bean>
EDIT 2 head section of the html
<head>
<title>Edowmis:: View Data in a Map </title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link href="/edowmis/styles/bootstrap/bootstrap.css/" rel="stylesheet">
<link href="/edowmis/styles/jquery/ui-smoothness/jquery-ui-1.10.3.custom.min.css/" rel="stylesheet">
<link href="/edowmis/styles/jqgrid/ui.jqgrid.css/" rel="stylesheet">
<script type="text/javascript" src="/edowmis/script/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/edowmis/script/bootstrap/bootstrap.js"></script>
<script type="text/javascript" src="/edowmis/script/jqgrid/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="/edowmis/script/jqgrid/grid.locale-en.js"></script>
<script type="text/javascript" src="/edowmis/script/jqgrid/jquery.contextmenu.js"> </script>

Converting an old JAX RPC WSDL file to a JAX WS WSDL file

I was wondering if is there some way to convert an old RPC WSDL file to a JAX-WS WSDL file. Tried my best to make sure I did my homework but I'm kind of lost here.
From what I've read, I should remove all the 'encodingstyle' ocurrences and switch use="encoded" to use="literal". I can't run any tests by now since the service is currently unavailable. Does anyone know if that should be enough? Any insight will be extremely appreciated.
This is my WSDL file:
<?xml version="1.0" encoding="iso-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wsScrc.XML" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wsScrc.XML">
<types>
<xsd:schema targetNamespace="urn:wsScrc.XML">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="XMLRequest">
<part name="parmA" type="xsd:string" />
<part name="parmB" type="xsd:string" />
<part name="parmC" type="xsd:string" />
<part name="parmD" type="xsd:string" />
<part name="parmE" type="xsd:string" />
<part name="parmF" type="xsd:string" />
<part name="parmG" type="xsd:string" />
</message>
<message name="XMLResponse">
<part name="respA" type="xsd:string" />
<part name="respB" type="xsd:string" />
<part name="respC" type="xsd:string" />
<part name="respD" type="xsd:string" />
<part name="respE" type="xsd:string" />
</message>
<message name="monitorRequest"></message>
<message name="monitorResponse">
<part name="ipServidor" type="xsd:string" />
</message>
<portType name="wsScrc.XMLPortType">
<operation name="XML">
<documentation>Retorna o xml</documentation>
<input message="tns:XMLRequest"/>
<output message="tns:XMLResponse"/>
</operation>
<operation name="monitor">
<documentation>Retorna uma mensagem de ok</documentation>
<input message="tns:monitorRequest"/>
<output message="tns:monitorResponse"/>
</operation>
</portType>
<binding name="wsScrc.XMLBinding" type="tns:wsScrc.XMLPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="XML">
<soap:operation soapAction="urn:wsScrc.XML#XML" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="monitor">
<soap:operation soapAction="urn:wsScrc.monitor#monitor" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="wsScrc.XML">
<port name="wsScrc.XMLPort" binding="tns:wsScrc.XMLBinding">
<soap:address location="http://thisismyaddress/webservicePHP/ws.php"/>
</port>
</service>
</definitions>
Thanks in advance.
We were able to do the same by altering the WSDL in that way.
The only issue is that we had to use SAAJ in order to generate the right request and to process the response.
In another WS we used it was just not possible because the XML in the body is generated by Castor. Finally we did not succeed as we did not know what the server expect.
In conclusion I would say: it depends how the server was implemented.

Resources