add a Queue JNDI ref in ejb-jar.xml? sending JMS Msg in a EJB/MDB - deployment

I have an EAR application which contains an MDB and a WAR.
In this EAR application I would send a message into an another Queue from other EAR application. Say jms/anotherQueue
If the message sending happens in web context, it works.
I have such setup in web.xml
<message-destination-ref>
<message-destination-ref-name>jms/anotherQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
<message-destination-link>jms/anotherQueue</message-destination-link>
</message-destination-ref>
But if the message sending occurs in EJB (MDB here) context, I will get a JNDI name lookup failure.
javax.naming.NameNotFoundException: anotherQueue
my ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" 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/ejb-jar_3_0.xsd">
<enterprise-beans>
<message-driven>
<ejb-name>jms/myMDB</ejb-name>
<ejb-class>com.my.MDBImplement</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>jms/myQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
</activation-config>
<resource-ref>
<res-ref-name>jms/myCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>jms/myMDB</ejb-name>
<method-name>onMessage</method-name>
<method-params>
<method-param>javax.jms.Message</method-param>
</method-params>
</method>
<trans-attribute>NotSupported</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
the openejb.jar is
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ejb:openejb-jar
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence"
xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment>
<dep:moduleId>
<dep:groupId>myGroup</dep:groupId>
<dep:artifactId>imyMDB</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>ejb</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
<dep:artifactId>activemq-broker</dep:artifactId>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<ejb:enterprise-beans>
<ejb:message-driven>
<ejb:ejb-name>jms/myMDB</ejb:ejb-name>
<ejb:resource-adapter>
<ejb:resource-link>myJmsResource</ejb:resource-link>
</ejb:resource-adapter>
</ejb:message-driven>
</ejb:enterprise-beans>
</ejb:openejb-jar>
I define myJmsResource in geronimo-application.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<app:application
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence"
xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment>
<dep:moduleId>
<dep:groupId>myGroup</dep:groupId>
<dep:artifactId>myEAR</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>ear</dep:type>
</dep:moduleId>
</dep:environment>
<app:module>
<app:connector>geronimo-activemq-ra-2.1.4.rar</app:connector>
<conn:connector>
<dep:environment>
<dep:moduleId>
<dep:groupId>myGroup</dep:groupId>
<dep:artifactId>myJmsResource</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
<dep:artifactId>activemq-broker</dep:artifactId>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<conn:resourceadapter>
<conn:resourceadapter-instance>
<conn:resourceadapter-name>myJmsResource</conn:resourceadapter-name>
<nam:workmanager>
<nam:gbean-link>DefaultWorkManager</nam:gbean-link>
</nam:workmanager>
</conn:resourceadapter-instance>
<conn:outbound-resourceadapter>
<conn:connection-definition>
<conn:connectionfactory-interface>javax.jms.ConnectionFactory</conn:connectionfactory-interface>
<conn:connectiondefinition-instance>
<conn:name>jms/myCF</conn:name>
<conn:implemented-interface>javax.jms.QueueConnectionFactory</conn:implemented-interface>
<conn:implemented-interface>javax.jms.TopicConnectionFactory</conn:implemented-interface>
<conn:connectionmanager>
<conn:xa-transaction>
<conn:transaction-caching />
</conn:xa-transaction>
<conn:single-pool>
<conn:match-all />
</conn:single-pool>
</conn:connectionmanager>
</conn:connectiondefinition-instance>
</conn:connection-definition>
</conn:outbound-resourceadapter>
</conn:resourceadapter>
<conn:adminobject>
<conn:adminobject-interface>javax.jms.Queue</conn:adminobject-interface>
<conn:adminobject-class>org.apache.activemq.command.ActiveMQQueue</conn:adminobject-class>
<conn:adminobject-instance>
<conn:message-destination-name>jms/myQueue</conn:message-destination-name>
<conn:config-property-setting name="PhysicalName">jms/myQueue</conn:config-property-setting>
</conn:adminobject-instance>
<!-- ******************************************************************** -->
<!-- define referred message destination ??? -->
<conn:adminobject-instance>
<conn:message-destination-name>jms/anotherQueue</conn:message-destination-name>
<conn:config-property-setting name="PhysicalName">jms/anotherQueue</conn:config-property-setting>
</conn:adminobject-instance>
</conn:adminobject>
<conn:adminobject>
<conn:adminobject-interface>javax.jms.Topic</conn:adminobject-interface>
<conn:adminobject-class>org.apache.activemq.command.ActiveMQTopic</conn:adminobject-class>
</conn:adminobject>
</conn:connector>
</app:module>
</app:application>
It seems that myMDB cannot understand what jms/anotherQueue is!!!
How can I fix it?

OK, I found a quick fix....
in ejb-jar.xml
<enterprise-beans>
<message-driven>
<ejb-name>jms/myMDB</ejb-name>
.....
<!-- referred queue -->
<resource-env-ref>
<resource-env-ref-name>jms/anotherQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
</message-driven>
</enterprise-beans>
I must admit, I still don't understand how to write a correct deployment plan.
I just goggle, copy, paste.....and mix up those deployment plans.

Related

sessionContext.getCallerPrincipal().getName() returns "anonymous"

I am new to EJB.
I am using Wildfly server.
I have session stateless Ejb as below.
#Stateless(name="PrintHandler")
#RunAs("TrustedExternalModule")
public class PrintHandlerBean extends ActivityBean implements PrintHandlerLocal {
The session ejb is packed to a server-ejb.jar and that jar is packed to .ear
I have created ejb-jar.xml and jboss-ejb3.xml inside META-INF folder in server-ejb.jar as below.
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
<enterprise-beans>
<session>
<ejb-name>PrintHandler</ejb-name>
<security-identity>
<run-as>
<role-name>TrustedExternalModule</role-name>
</run-as>
</security-identity>
</session>
</enterprise-beans>
</ejb-jar>
<?xml version="1.1" encoding="UTF-8"?>
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="urn:security:1.1"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd http://java.sun.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-spec-2_0.xsd"
version="3.1"
impl-version="2.0">
<jboss:enterprise-beans>
<session>
<ejb-name>PrintHandler</ejb-name>
<session-type>Stateless</session-type>
<security-identity>
<run-as>
<role-name>TrustedExternalModule</role-name>
</run-as>
</security-identity>
</session>
</jboss:enterprise-beans>
<assembly-descriptor>
<s:security>
<ejb-name>PrintHandler</ejb-name>
<s:security-domain>other</s:security-domain>
<s:run-as-principal>TESTCONNECT</s:run-as-principal>
</s:security>
</assembly-descriptor>
</jboss:ejb-jar>
I am injecting SessionContext annotated with Resource in a non ejb class as below.
public abstract class AbstractBean {
protected AbstractBean() {
log = LogMgr.getFrameworkLogger();
clsLog = LogMgr.getClassLogger(FndAbstractBean.class);
if(clsLog.debug) {
clsLog.debug("Created bean [&1]", getClass().getName());
}
}
**#Resource
protected SessionContext sessionContext;**
But when I am calling String user = sessionContext.getCallerPrincipal().getName();
it is returning "anonymous" always.
How can I solve this.
I want to get caller principal as TESTCONNECT.
Hello, this seems to be an expected behavior. The only workaround I found would be to use Interceptor,so then you can propagate the information actually. Interceptors is explained here

Server was unable to process request.,Object reference not set to an instance of an object. SOAP API

want to push data through soap API, code provided in API documentation is given below. i am getting error. error i am getting. let me know where i am wrong, thanks in advance.
url
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<PushData xmlns="RBSS">
<RBSS>
<Lead_Response_DateTime>20-05-2016 10:25:16</Lead_Response_DateTime>
<Lead_Push_DateTime>20-05-2016 10:25:16</Lead_Push_DateTime>
<Lead_Recd_DataTime>20-05-2016 10:25:16</Lead_Recd_DataTime>
<FirstName>test</FirstName>
<Phone1>9876543215</Phone1>
<Phone2>9876543215</Phone2>
<Email>amrit#gmail.com</Email>
<DOB>20-05-2016</DOB>
<Age>26</Age>
<Child_DOB>20-05-2002</Child_DOB>
<Child_Age>4</Child_Age>
<Pincode>400052</Pincode>
<City_Name>Mumbai</City_Name>
<Address>2, Akshardham…..</Address>
<Annual_Income>1000000</Annual_Income>
<Annual_Income_Slab>10</Annual_Income_Slab>
<SMS_Keyword>0</SMS_Keyword>
<Short_Code></Short_Code>
<Circle_Operator></Circle_Operator>
<Sum_Assured></Sum_Assured>
<Premium_Pitched></Premium_Pitched>
<Company_Name>WRS</Company_Name>
<Website_Name>Bima Deals.com</Website_Name>
<UTN_Source>FaceBook</UTN_Source>
<Lead_Source></Lead_Source>
<Type_Of_Lead></Type_Of_Lead>
<Verification_Type></Verification_Type>
<Product_Name></Product_Name>
<Product_Category></Product_Category>
<No_of_Companies></No_of_Companies>
<Names_of_Companied></Names_of_Companied>
<SMS_Message_Sent></SMS_Message_Sent>
<Customer__Remarks></Customer__Remarks>
<FLAG></FLAG>
<Lead_Type>INCOMING_WEB</Lead_Type>
<Channel_Type>INTERNET</Channel_Type>
<Mode_Type>PREFIXED_APPOINTMENT</Mode_Type>
<Source_Type>BIMADEALS</Source_Type>
<Campaign_Type>APR_16</Campaign_Type>
<Opportunity_Id>123456</Opportunity_Id>
<PROSPECT_ID></PROSPECT_ID>
<Title>MR</Title>
<UID></UID>
<LastName>Lastname</LastName>
<Gender>Male</Gender>
<MaritalStatus></MaritalStatus>
<MobileNo>9865856325</MobileNo>
<AgeAtRetirement></AgeAtRetirement>
<VendorCSE_Name></VendorCSE_Name>
<TermOfPlan></TermOfPlan>
<Smoker_NonSmoker></Smoker_NonSmoker>
<VendorCode></VendorCode>
<MeetingDate></MeetingDate>
<MeetingTime></MeetingTime>
<City_ID>67</City_ID>
<ID>123</ID>
<CallcenterID></CallcenterID>
<ADDLInfo1></ADDLInfo1>
<ADDLInfo2></ADDLInfo2>
</RBSS>
</PushData>
</soap:Body>
</soap:Envelope>

Apache camel cxfrs—Can't find the request for <URL> Observer

I tried to develop a rest service and expose the same via Apache Camel's CXFRS. I followed all the steps given in http://camel.apache.org/cxfrs.html and also referred to many samples given. I already referred to the question Can't find the the request for url Observer, but in my case it is a simple rest request. Below are the Service class, Route class, and cxf context used:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<context:annotation-config />
<!-- enable Spring #Component scan -->
<context:component-scan base-package="org.camelsample.rest" />
<cxf:rsServer id="rsServer" address="/rest"
serviceClass="org.camelsample.rest.service.SampleRestService"
loggingFeatureEnabled="true" loggingSizeLimit="20">
<cxf:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</cxf:providers>
</cxf:rsServer>
<camel:camelContext id="samplerestservice"
xmlns="http://camel.apache.org/schema/spring">
<contextScan />
<jmxAgent id="agent" createConnector="true" />
</camel:camelContext>
</beans>
The Service Class:
package org.camelsample.rest.service;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
public class SampleRestService {
#GET
#Path("/")
public String sampleService() {
return null;
}
}
The Route Class:
package org.camelsample.rest.route;
import org.apache.camel.spring.SpringRouteBuilder;
public class SampleRestRoute extends SpringRouteBuilder {
#Override
public void configure() throws Exception {
// TODO Auto-generated method stub
from("cxfrs:bean:rsServer").log("Into Sample Route").setBody(constant("Success"));
}
}
But when I try to hit and test using http://localhost:8080/rest, I always get the following error message:
2015-05-29 13:38:37.920 WARN 6744 --- [nio-8080-exec-2] o.a.c.t.servlet.ServletController : Can't find the the request for http://localhost:8080/favicon.ico's Observer
2015-05-29 13:38:40.295 WARN 6744 --- [nio-8080-exec-3] o.a.c.t.servlet.ServletController : Can't find the the request for http://localhost:8080/rest's Observer
Am using Spring boot to test the rest sample.
Does it work with this URL instead ?
http://localhost:8181/cxf/rest
If you just use address="/rest" as your address then you will probably get the default Jetty port 8181 and default CXF servlet path /cxf as the base URL.
If you specifically want to use the URL you have given then try this instead:
address="http://0.0.0.0:8080/rest"

Customer attributes not saving on Add

So I've been experimenting with adding customers to QuickBooks Online from a local database instance at our business. I want to keep track of our internal customer reference numbers in QBO, so have tried to save those to several different attributes like AcctNum, ExternalKey, ExternalId, AlternateId, or even directly to the Id attribute. After attempting to save to these fields, the return result looks good.
var qbCustomer = new Customer
{
AcctNum = customer.CustRef.ToString(CultureInfo.InvariantCulture),
ExternalKey = new IdType {idDomain = idDomainEnum.NG, Value = customer.CustRef.ToString(CultureInfo.InvariantCulture)},
Id = new IdType {idDomain = idDomainEnum.NG, Value = customer.CustRef.ToString(CultureInfo.InvariantCulture)},
Name = customer.CustName1,
FamilyName = customer.CustRef.ToString(CultureInfo.InvariantCulture),
};
Customer resultCustomer = dataServices.Add(qbCustomer);
But the next time I retrieve those customers, all of those fields are just null. Why are these fields not saving? Is there another more appropriate field to use to store an external ID besides just using one of the plain text fields (Name, Address, etc.)?
UPDATE:
Here's the raw XML exchange.
What I sent when adding a new customer:
<?xml version="1.0" encoding="utf-8"?>
<q1:Customer xmlns="http://www.intuit.com/sb/cdm/qbo" xmlns:q1="http://www.intuit.com/sb/cdm/v2">
<q1:Id>7</q1:Id>
<q1:ExternalKey>7</q1:ExternalKey>
<q1:TypeOf>Person</q1:TypeOf>
<q1:Name>Customer Name</q1:Name>
<q1:FamilyName>7</q1:FamilyName>
<q1:AcctNum>7</q1:AcctNum>
</q1:Customer>
Intuit's response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Customer xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">12</Id>
<SyncToken>0</SyncToken>
<MetaData><CreateTime>2013-07-25T13:51:43-07:00</CreateTime><LastUpdatedTime>2013-07-25T13:51:43-07:00</LastUpdatedTime></MetaData>
<Name>Customer Name</Name>
<WebSite/>
<Email/>
<FamilyName>7</FamilyName>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField"><DefinitionId>Preferred Delivery Method</DefinitionId><Value>DONT</Value></CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField"><DefinitionId>Resale Number</DefinitionId></CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="BooleanTypeCustomField"><DefinitionId>Bill With Parent</DefinitionId><Value>false</Value></CustomField>
<ShowAs>Erik Kunze/Magdalena Guarda Munoz</ShowAs>
<OpenBalance><Amount>0</Amount></OpenBalance>
</Customer>
My retrieval later:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<qbo:SearchResults xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<qbo:CdmCollections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Customers">
<Customer>
<Id idDomain="QBO">12</Id>
<SyncToken>0</SyncToken>
<MetaData><CreateTime>2013-07-25T13:51:43-07:00</CreateTime><LastUpdatedTime>2013-07-25T13:51:43-07:00</LastUpdatedTime></MetaData>
<Name>Customer Name</Name>
<WebSite/>
<Email/>
<FamilyName>7</FamilyName>
<CustomField xsi:type="BooleanTypeCustomField"><DefinitionId>Bill With Parent</DefinitionId><Value>false</Value></CustomField>
<CustomField xsi:type="StringTypeCustomField"><DefinitionId>Preferred Delivery Method</DefinitionId><Value>DONT</Value></CustomField>
<ShowAs>Erik Kunze/Magdalena Guarda Munoz</ShowAs>
<OpenBalance><Amount>0</Amount></OpenBalance>
</Customer>
</qbo:CdmCollections>
<qbo:Count>1</qbo:Count>
<qbo:CurrentPage>1</qbo:CurrentPage>
</qbo:SearchResults>
There's no AcctNum in the raw XML anywhere.
You are referring QBD's customer endpoint in apiexplorer.
Correct QBO link - https://developer.intuit.com/apiexplorer?apiname=V2QBO#Customer
Api Docs & Sample Create request - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/customer#Sample_Create_Request_XML
Simplest request body to create QBO customer -
<Customer xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns3="http://www.intuit.com/sb/cdm/baseexceptionmodel/xsd">
<TypeOf>Person</TypeOf>
<Name>TestQBCustomer12345</Name>
</Customer>
Simplest Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Customer xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">14</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-07-25T14:08:49-07:00</CreateTime>
<LastUpdatedTime>2013-07-25T14:08:49-07:00</LastUpdatedTime>
</MetaData>
<Name>TestQBCustomer12345</Name>
<WebSite/>
<Email/>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField">
<DefinitionId>Preferred Delivery Method</DefinitionId>
<Value>DONT</Value>
</CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="StringTypeCustomField">
<DefinitionId>Resale Number</DefinitionId>
</CustomField>
<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="BooleanTypeCustomField">
<DefinitionId>Bill With Parent</DefinitionId>
<Value>false</Value>
</CustomField>
<ShowAs>TestQBCustomer12345</ShowAs>
<OpenBalance>
<Amount>0</Amount>
</OpenBalance>
</Customer>
You can test it first using apiexplorer then use the proper setters to do the same in your code.
Please let me know how it goes.
Thanks
Refer to the documentation:
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/customer
You'll note that:
Id is an internal key generated by IPP/IDS - it's NOT something you can set yourself.
ExternalKey is the same situation - it's generated by IPP/IDS, not set-able by you.
ExternalId is marked "UNSUPPORTED FIELD."
AlternateId is marked "NOT SUPPORTED."
The only one of these fields that should work is:
AcctNum
If you're still having problems with that field, the way to troubleshoot is to get the raw XML outgoing request from Intuit, the raw XML that you get back (showing success) and then the raw response that you get back when you query it, showing that it's NULL.

How to change the preferences so that each window displays something different?

I'm trying to override values of preferences, but nothing overrides.
Does anyone know how to fix this?
portlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>cool_portlet</portlet-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<resource-bundle>com.app.portlet.cool_portlet</resource-bundle>
<portlet-info>
<title>Cool Portlet</title>
</portlet-info>
<portlet-preferences>
<preference>
<name>KEY</name>
<value>TEST</value>
<read-only>false</read-only>
</preference>
</portlet-preferences>
</portlet>
</portlet-app>
portlet-instances.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portlet Instances 2.6//EN" "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
<deployment>
<instance>
<instance-id>coolPortlet_IMPORT_newInstance</instance-id>
<portlet-ref>cool_portlet</portlet-ref>
<preferences>
<name>KEY</name>
<value>IMPORT</value>
</preferences>
</instance>
</deployment>
<deployment>
<instance>
<instance-id>coolPortlet_EXPORT_newInstance</instance-id>
<portlet-ref>cool_portlet</portlet-ref>
<preferences>
<name>KEY</name>
<value>EXPORT</value>
</preferences>
</instance>
</deployment>
</deployments>
cool_portlet-object.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portlet Instances 2.6//EN" "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
<deployment>
<parent-ref>comportal.import</parent-ref>
<if-exists>overwrite</if-exists>
<window>
<window-name>impWindow</window-name>
<content>
<content-type>portlet</content-type>
<content-uri>coolPortlet_IMPORT_newInstance</content-uri>
</content>
<region>center</region>
<height>1</height>
<supported-window-states>
<window-state>normal</window-state>
<window-state>maximized</window-state>
<window-state>minimized</window-state>
</supported-window-states>
<initial-window-state>normal</initial-window-state>
</window>
</deployment>
<deployment>
<parent-ref>comportal.export</parent-ref>
<if-exists>overwrite</if-exists>
<window>
<window-name>expWindow</window-name>
<content>
<content-type>portlet</content-type>
<content-uri>coolPortlet_EXPORT_newInstance</content-uri>
</content>
<region>center</region>
<height>1</height>
<supported-window-states>
<window-state>normal</window-state>
<window-state>maximized</window-state>
<window-state>minimized</window-state>
</supported-window-states>
<initial-window-state>normal</initial-window-state>
</window>
</deployment>
</deployments>
MainController.java
#RequestMapping(value = "VIEW")
#Controller(value = "mainController")
public class MainController {
#RenderMapping
public String init(#RequestParam(value = "key", required = false) String key, Model model, PortletRequest request) throws Exception {
PortletPreferences preferences = request.getPreferences();
String preferencesKey = preferences.getValue("KEY", "Not Found!!!");
System.out.println("KEY is : " + preferencesKey);
model.addAttribute("preferencesKey", preferencesKey);
return "index";
}
}
Output:
13:49:54,860 INFO [STDOUT] KEY is : TEST
13:50:21,088 INFO [STDOUT] KEY is : TEST
You need to call setValue and then store your PortletPreferences object. Note that preferences can only be stored in action phase. visit