JS to change object XML tag
Hi
any one knows how to change a tagged object's XML tag from say Aold to Bnew without affecting it's content and position in the XML structure?
Thank you
Hello. I'm new here but it seems to be the only place where I can post this question to.
I'm working in a C# application that uses InDesign CS3 scripting. I'm trying to create an index automatically from a tabbed list of words in a text file.
As C# is a strongly typed language, I have to cast all objects to the right type. I'm having problems when I try to add the page numbers to the created index entries using the following code (I've used the CreateIndexEntry.jsx scrip as a starting point).
//Find all occurrences of the word or set of words (the topic name)
((InDesign.FindTextPreference) app.FindTextPreferences).FindWhat = topic.Name;
InDesign.Objects foundTexts = doc.FindText(System.Reflection.Missing.Value);
It's supposed to be an Array of Text objects (InDesign.Text) but when I try to cast each object using this
//Code is forced because I've tried everything here
//Loop through each finding and add page numbers to topic
IEnumerator textEnum = foundTexts.GetEnumerator();
while (textEnum.MoveNext())
object text = textEnum.Current;
topic.PageReferences.Add((InDesign.Text)text, InDesign.idPageReferenceType.idCurrentPage, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
I got the following exception (translated).
text is not an InDesign.Text object (Interfaces doesn't match)
So the question is what object type should I use to cast each object resulting by calling the Document's FindText method.
Every suggestion will ve very welcome.
Thank You very much.
Similar Messages
-
ALE/IDOC to XML - Need to Change the xml tags
Hi Experts,
I am creating xml files from idocs via ALE and an XML Port and sending them to a third party system (no programming required, all standard functionality). The field labels or tags within these xml files are automatically generated by SAP based on the idoc segment definitions. Unfortunately, the receiving system cannot process these tags...they require very specific tag names.
Is there a way to interceed before the actual files are created and change these tag names? If so, how?
Thanks very much for useful information!
DebHi Rejoice S
see following blog define tyour scenario step wise step
Collecting IDocs without using BPM
if helfull give rewrad point
thanks
Amit Shivhare -
is it possible with SYS_XMLGEN and xmlelement
to change the xml tag <?xml version="1.0"?> and add a encoding attr like <?xml version="1.0" encoding="UTF-8" ?>
when making xmltype from a query?select xmltype( '<?xml version="1.0" encoding="UTF-8" ?>' ||
xmlelement( "xx", dummy ).getclobval()
).getclobval()
from dualCode like this will result in a CLOB, which uses the characterset of the database and NOT the characterset specified in the encoding of the XML-header
Anton -
[JS][CS4-5] Apply hyperlink to xml tagged object
Hi,
Can anyone please help me? I'm strugling with this problem for days....
I'm trying to apply a new hyperlink to a xml tagged object (piece of text, frame or image)...
The script trows an error "wrong source. Expected text but received XML element"
Does anyone know how i can fix this?
Thanks
Code:
var myDoc = app.documents[0];
Check(myDoc.associatedXMLElement);
alert("Done !");
//recursive function
function Check(elm){
for(var i=0; i<elm.xmlElements.length; i++){
myXMLElement = elm.xmlElements[i];
XMLelementName = myXMLElement.markupTag.name.toString();
// only apply to tagged object using the tag "Hyperlink"
if (XMLelementName == "Hyperlink"){
var myHyperlinkURL = myDoc.hyperlinkURLDestinations.add("http://www.google.com");
myHyperlinkURL.name = "http://www.google.com";
var myObject = elm.parent;
if(!( elm.xmlAttributes.item("href") == null)){
// it's a picture
// i'm not sure this will work
myHyperlinkSource = myDoc.hyperlinkPageItemSources.add(myObject);
}else{
// it's not a picture
// Error is in the line below
myHyperlinkSource = myDoc.hyperlinkTextSources.add(myObject);
var myHyperlink = myDoc.hyperlinks.add(myHyperlinkSource, myHyperlinkURL);
// process all sub elements
for (var i = 0; i < elm.xmlElements.length; i++){
Check(elm.xmlElements[i]);Hi,
Thanks for your feedback.
Due to your great feedback, I've made some changes to the line below...
var myObject = elm.texts[0];
When performing the script, a hyperlink is added to all text in the textframe, not only to the text tagged by the xml tag. Does anyone know how this can be fxed?
Also, when trying to do the same thing for an image, but this doen't work...
var myObject = elm.images[0];
An error occures.
And what about a empty graphic frame ? How can I add a hyperlink to frame if it's tagged by a certain xml tage?
Any feedback would be helpfull...
Tim -
How to change XML Tag sequence in XML Publisher Reports
Hi Experts,
I am working on XML Publisher reports, EBS 11I and Database 9i. I have standard report 'PO Printed Purchase Order Report (XML)', it's output type is XML. I want to change the sequence of groups in XML file.
I am getting XML tags like below at present:
LIST_G_HEADERS \ G_HEADERS \ LIST_G_HEADER_NOTES
I want to change the sequence of groups like below.
LIST_G_HEADERS \ G_HEADERS \ LIST_G_LINES \
Could somebody help me how to change the sequence of XML Groups.
Thanks in advance.Paul,
This works. Thanks!
I am still working through the implications of having a data connection defined. I notice that every time I submit, it creates two records in my database, one with all the fields blank, and one with the data and attachment.
I will have to do some more digging into the double submission, but at least it is uploading the file.
Thanks again,
Ed -
XML tag need to be change in the sorce file (ENCODING)
Hi
my source file XML format.. in this file I'm getting as a first tag as like this.. <b><?xml version="1.0" encoding="ISO-8859-1"?>..</b> but actually in my Message mapping source code i have starting tag is like this...
<b><?xml version='1.0' encoding = 'UTF-8" ?></b>
so, som encoding is different.. for this how can solve the problem.. wether i need to change in the source file itself.. or is there any solution to change that in our scenario itself..
plz clarryfy this..
Thanks
babuHi Babu,
Check out my answers in this Link
Re: How to change the incoming xml to a different namespace
this way you can modify the XML tags which are beyond the reach of mapping
Regards
Vishnu -
Object-XML Binding: How do I map from java to enumerated xml tags
Hi. I'm new to Object-XML binding and toplink. XML that I'm trying to model in a schema has enumerated elements, e.g. </module_0></module_1><module_n> instead of many </module> elements. To simplify the schema I've opted to use </module> anyway with unbounded cardinality and imported this into a new project.
What I would like to know is if I can use Toplink to map the java object back to the enumerate element types and vice versa?
Thanks for your help.
GeePeeHi Geepee,
Below is an approach you can use if you have a fixed number of moduleX elements. In the example below X=3.
Assume a 2 object model Root & Module, where Root has a list of Module instances:
@XmlRootElement(name="root")
public class Root {
private List<Module> module = new ArrayList<Module>(3);
...// Accessors omitted
}It is currently not possible to map the items in the module list to the XML elements (module1-module3), but it would be possbile to map an object (see below) with 3 properties to those XML elements:
public class AdaptedModuleList {
private Module module1;
private Module module2;
private Module module3;
...// Accessors omitted
}What is required is a means to convert the unmappable object to a mappable one. This is done using a Converter:
import org.eclipse.persistence.mappings.DatabaseMapping;
import org.eclipse.persistence.mappings.converters.Converter;
import org.eclipse.persistence.sessions.Session;
public class ModuleListConverter implements Converter {
public void initialize(DatabaseMapping mapping, Session session) {}
public Object convertDataValueToObjectValue(Object dataValue, Session session) {
AdaptedModuleList adaptedModuleList = (AdaptedModuleList) dataValue;
if(null == adaptedModuleList) {
return null;
List<Module> moduleList = new ArrayList<Module>(3);
moduleList.add(adaptedModuleList.getModule1());
moduleList.add(adaptedModuleList.getModule2());
moduleList.add(adaptedModuleList.getModule3());
return moduleList;
public Object convertObjectValueToDataValue(Object objectValue, Session session) {
List<Module> moduleList = (List<Module>) objectValue;
if(null == moduleList) {
return null;
AdaptedModuleList adaptedModuleList = new AdaptedModuleList();
int moduleListSize = moduleList.size();
if(moduleListSize > 0) {
adaptedModuleList.setModule1(moduleList.get(0));
if(moduleListSize > 1) {
adaptedModuleList.setModule2(moduleList.get(1));
if(moduleListSize > 2) {
adaptedModuleList.setModule3(moduleList.get(2));
return adaptedModuleList;
public boolean isMutable() {
return true;
}The converter is added to the mapping metadata through the use of a Customizer:
import org.eclipse.persistence.config.DescriptorCustomizer;
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping;
import org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping;
public class RootCustomizer implements DescriptorCustomizer {
public void customize(ClassDescriptor descriptor) throws Exception {
XMLCompositeCollectionMapping originalModuleMapping = (XMLCompositeCollectionMapping) descriptor.removeMappingForAttributeName("module");
XMLCompositeObjectMapping newModuleMapping = new XMLCompositeObjectMapping();
newModuleMapping.setAttributeName(originalModuleMapping.getAttributeName());
newModuleMapping.setXPath(".");
newModuleMapping.setReferenceClass(AdaptedModuleList.class);
newModuleMapping.setConverter(new ModuleListConverter());
descriptor.addMapping(newModuleMapping);
}Part 1/2 -
IDOC to File, variable substitution on outbound message XML tag attributes
My scenario is IDOC to FILE using XSL mappings.The target format is 2 XML tags (header, line) with the data stored in the attributes of each tag.
EG. <header attr1=one attr2=two attr3=three><line attr1=one attr2=two /></header>
The name of the file is dictated by an outbound attribute value in the header tag.
Can I get access to it the attribute in the target message in the CC_FILE using variable substution. ?
Currently I am not using content conversion as the XSL produces the file format needed, so I would pefer not to change the outbound message format/structure as this is going to an external party. I would prefer not to change the outbound format as this would need content conversion to strip the unwanted/information/processing node that is used for this purpose (file naming).
The name is a calculation of fields in the IDOC and is not explicit dictated (business logic is applied in the mapping to get the file name), so I would prefer to use the attribute of the resulting XML to keep the "business logic" in the XSL..
Things that cannot be changed.... 1. Must use XSL.for mapping. 2. Format cannot be changed of the outbound message. 3. Would prefer not to involved content conversion to keep formatting/node structure in the XSL mapping.
I have seen some reference to this being possible on the forums but nothing solid from what Ive read.
Something like var1 = payload:/Header/@attr1 in variable sub to get at the attribute
Any comments ?
Thanks in advance.
One final piece of info. its on a PI 7.1 system.I think its best explained by my other thread Link:PI 7.1 Access to Dynamic Configuration through Java Class .
Thanks for the link I have already implemented based on that link but the one crucial difference is that it is implemented using a static method with no reference to the actual object (payload) for Dynamic configuration. It seems that without the 7.0 API which isnt available in 7.1 by default XSL with java extentions is limited to static methods. If you could read the other thread it certainly is possible I'm mistaken. -
How to filter particular xml tag value using -DBMS_XMLGEN / DBMS_XMLSTORE
Hi,
I am using dbms_xmlgen and dbms_xmlstore package to extract xml datafile tag value from file server to oracle database table.
I have used the below pl/sql program to extract the xml tag values to oracle relational table.Its working fine for me.
But I would like to extract the values based on particular filter condition.
The following xml program I have 3 rows I would like extract the xml data based on the following condition .
Filter condition
==============
the tag <STATE_ABBREVIATION> value shuold be 'CA' and the <CITY> tag value should be Palo_Alto then I will store the ZIPCODE
ZIP_CODE_EXTN,STATE_ABBREVIATION tag values in the Oracle Relational table.
The below pl/sql program storing all the three rows but I required the values based on the filter condition that I mentioned earlier.
Kindly assist me what are the steps that I need to change in this program.?
XML Program file content.
======================
<ZIPCODES>
<mappings>
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>94301</ZIPCODE>
<ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
<CITY>Palo_Alto</CITY>
</mappings>
<mappings>
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>95302</ZIPCODE>
<ZIP_CODE_EXTN>9279</ZIP_CODE_EXTN>
<CITY>LA</CITY>
</mappings>
<mappings>
<STATE_ABBREVIATION>TX</STATE_ABBREVIATION>
<ZIPCODE>75038</ZIPCODE>
<ZIP_CODE_EXTN>7837</ZIP_CODE_EXTN>
<CITY>DALLAS</CITY>
</mappings>
</ZIPCODES>
PL/SQL Program for XML extract.
==========
declare
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp number;
insCtx DBMS_XMLStore.ctxType;
ctx dbms_xmlgen.ctxHandle;
v_FileHandle UTL_FILE.FILE_TYPE;
begin
v_FileHandle := utl_file.fopen('XMLTEST','XML_NEW_CITIES.XML','r') ;
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
insCtx := DBMS_XMLStore.newContext('SYS.ZIPCODES');
dbms_xmlgen.setRowsetTag(insCtx,'ZIPCODES');
dbms_xmlgen.setRowsetTag(insCtx,'mappings');
DBMS_XMLStore.clearUpdateColumnList(insCtx);
DBMS_XMLStore.setUpdateColumn(insCtx,'ZIPCODE');
DBMS_XMLStore.setUpdateColumn(insCtx,'ZIP_CODE_EXT N');
DBMS_XMLStore.setUpdateColumn(insCtx,'STATE_ABBREV IATION');
rowsp := dbms_xmlstore.insertXML(insCtx,finalstr);
end;
Thanks,
natThanks for your reply. :)
Its working fine in the DBMS_XMLSTORE package. Here I have given the code
CREATE OR REPLACE TYPE typ_dummy AS OBJECT
( "@ENO" NUMBER,
"@ENAME" VARCHAR2(100),
eno NUMBER,
ename VARCHAR2(100));
CREATE TABLE EMP
empno VARCHAR2(25),
sal NUMBER,
hiredate DATE,
typ TYP_DUMMY
DECLARE
insCtx DBMS_XMLStore.ctxType;
rows NUMBER;
xmldoc CLOB :=
'<ROWSET>
<ROW num="1">
<SAL>1800</SAL>
<EMPNO>739</EMPNO>
<HIREDATE>27-AUG-1996</HIREDATE>
<TYP ENO="739" ENAME="Nazurullah">
<ENO> 1 </ENO>
<ENAME> ALDRIN </ENAME>
</TYP>
</ROW>
<ROW>
<SAL>18000</SAL>
<EMPNO>7369</EMPNO>
<HIREDATE>27-AUG-1996</HIREDATE>
<TYP ENO="7369" ENAME="PEPPIN" />
</ROW>
<ROW>
<SAL>37000</SAL>
<EMPNO>20701</EMPNO>
<HIREDATE>27-AUG-1996</HIREDATE>
<TYP>
<ENO> 20701 </ENO>
<ENAME> VENKATACHALAM </ENAME>
</TYP>
</ROW>
</ROWSET>';
BEGIN
insCtx := DBMS_XMLStore.newContext('emp'); -- get saved context
-- Now insert the doc.
-- This will only insert into EMPNO, SAL and HIREDATE columns
rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
-- Close the context
DBMS_XMLStore.closeContext(insCtx);
END;
SELECT * FROM emp;
EMPNO SAL HIREDATE TYP(@ENO, @ENAME, ENO, ENAME)
739 1800 27-AUG-96 TYP_DUMMY(739, 'Nazurullah', 1, ' ALDRIN ')
7369 18000 27-AUG-96 TYP_DUMMY(7369, 'PEPPIN', NULL, NULL)
20701 37000 27-AUG-96 TYP_DUMMY(NULL, NULL, 20701, ' VENKATACHALAM ') -
Mapping of XML tags with column
My xml structure is :
<PARAMS>
<ROWSET>
<ROW NUM="1">
<SID>man123</SID>
<PO>
<PO>OBJ1</PO>
<PI>
<PI>PARENTOBJ1 INSTANCE</PI>
</PI>
</PO>
</ROW>
</params>
My table structure is :
CREATE TABLE TEMP(SID VARCHAR2(20),PO POBJECT_T)
where Object types are:
CREATE OR REPLACE TYPE PINSTANCE_T AS OBJECT (PI VARCHAR2(255),CO COBJECT_T);
CREATE OR REPLACE TYPE POBJECT_T AS OBJECT (PO VARCHAR2(255),PI PINSTANCE_T);
To store this XML directly into table i have to have Column with name "PO" (same as XML tag).I am using this same table to store other XML with same tags . With this limitation its difficult to do so.Is there any way to map XML tag to column with different name????
ThanksHi,
thx for your Reply,
seems to work basicly but i get now in the IDE warnings with:
"Data binding will not be able to detect changes when using
square bracket operator. For Array, please use
ArrayCollection.getItemAt() instead. "
And how can i access the next item something like this didnt
work right
try someniceid.lastResult["some-root"]["someother-root"]
I had to use single quotes (') to get it to work.
Any ideas?
Kind regards,
Marko -
Embedding inline HTML data in XML using the mx:XML tag with <; and >;
What is best practice for embedding HTML within the
<mx:XML> tag? Programmatically, I can implement this
successfully:
[Bindable]
public var xmlDP:XML = <component data="<" />;
However, I get the following error if I try to store the same
data inline in an mx:XML tag, as such:
<mx:XML id="xmlDP">
<component data="<" />
</mx:XML>
Error #1095: XML parser failure: Unterminated attribute.
If I change the MXML tag as follows, it works fine:
<mx:XML id="xmlDP">
<component data="&lt;" />
</mx:XML>
Unfortunately, I also can not source the mx:XML tag to an XML
file which uses < or > codes, as it yields the same
results. This leads me to believe that the <mx:XML> tag does
not support the special character codes for < and >, but why?
Incidentally, this code also gives a 1095 error:
<mx:XML id="xmlDP">
<component data="<" />
</mx:XML>
This is causing an issue with my source data as it is not
hand typed into Flex, and standard XML supports the < and
> codes. I have tried a full HTML string, as shown below,
but this also generates the error:
<mx:XML id="xmlDP">
<component data="<b>Test</b>"
/>
</mx:XML>
Many thanks for any input you may have!I’m generating the XML source file with
Microsoft’s XML Notepad 2007. It will encode invalid special
characters automatically. My understanding is that this is the
proper way to handle the less than symbol in a XML string, that is
to say using the < code.
With respect to the escape and un-escape methods, I am able
to successfully implement these in AS, but not in MXML. This makes
sense considering they are AS methods, but I was hoping to be able
to do something like:
<mx:XML id="xmlDP">
<component data="escape('<');" />
</mx:XML>
This gives the following compilation error:
The value of attribute "data" must not contain the '<'
character.
As does using the escape character as such:
<mx:XML id="xmlDP">
<component data="\<" />
</mx:XML>
Below is an example of what the escape character may be used
for in AS:
var myString:String = "\"";
trace(myString);
// result: "
Likewise, I can escape the < character as such:
var myString:String = escape("<");
trace(myString);
// result: %3C
<mx:XML id="xmlDP">
<component data="%3C" />
</mx:XML>
trace(un-escape(xmlDP.@data));
// result: <
As you can see, using %3C and unescaping in AS will yield the
correct result; however, this is not a practical method of
representing the data in MXML as I would have to write an AS method
to un-escape the XML string anyway, so I might as well just store
the data in AS to begin with. I was hoping for a way to source an
mx:XML object, without having to load it into ActionScript
manually. Here’s an example of the functionality I would
expect:
<mx:XML id="xmlDP">
<component data=">" />
</mx:XML>
trace(xmlDP.@data);
// result: >
Only this does not work for the less than symbol. I’m
assuming at this point that this is a bug in the Flex compiler.
Thanks again for your help troubleshooting this one! -
How to pass XML tags in a soapbody parameter having datatype as string?
Hi,
I need to pass XML tags as a String parameter in SOAP:Body.
When I tried send SOAP Request, The SOAP Request was changing < to <
and > to > respectively. Is there any way to ensure that the XML tags (< and >) remain as it is without getting changed.
I also tried to retrieve XML file and stored in a StringBuffer and tried to send SOAP Request but i am still receiving the < and > tags in my SOAP Request.
Pl suggest some alternatives to avoid storing the XML in the form of string and instead directly store the XML into a XML Node so that i can avoid the above condition
Thanks in advance,
gnsinhydHi,
The sample code I used is as follows:
package somepackage;
import javax.mail.internet
import javax.xml.messaging.*;
import javax.xml.soap.*;
import javax.xml.transform.*;
import javax.activation.*;
public class SomeClassName{
// Some namespace declarations
public static void main(String[] args) throws someExceptions{
try
// Create the connection
SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = connectionFactory.createConnection();
// create a new SOAP message using SAAJ API�s
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage request = messageFactory.createMessage();
// Create a SoapAction header
MimeHeaders headers = request.getMimeHeaders();
headers.addHeader("SOAPAction", "soapaction url");
// Object for SOAP Message parts
SOAPPart part = request.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
envelope.addNamespaceDeclaration("xsd","http://www.w3.org/2001/XMLSchema");
envelope.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
//envelope.addNamespaceDeclaration("enc","http://schemas.xmlsoap.org/soap/encoding/");
envelope.addNamespaceDeclaration("soap","http://schemas.xmlsoap.org/soap/envelop/");
//envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
SOAPBody body = envelope.getBody();
SOAPHeader header = envelope.getHeader();
// Now, build the ClaimStorage element in the body for our request
Name somename = envelope.createName("somename");
// � and configure it with the specifics of our request
SOAPElement ClaimStorage = body.addTextNode("somename");
ClaimStorage.addNamespaceDeclaration("xmlns","url");
ClaimStorage.addChildElement(somename).addTextNode("somename");
ClaimStorage.addChildElement(xmlclaim).addTextNode("<XMLTAGS">); <---THE PROBLEM IS HERE
----> THE XML TAGS < > ARE CHANGING TO < AND > MOST PROBABLY DUE TO POST I THINK.
// Save Message
request.saveChanges();
// View SOAP Request
System.out.println("\n Soap Request:\n");
request.writeTo(System.out);
System.out.println();
// Now, create a connection to the HTTP SOAP endpoint
URLEndpoint endpoint = new URLEndpoint("url.asmx");
// Send request, view response. In a real program, we�d process the response envelope programmatically to see if there was a fault, etc.
System.out.println("request =\n" + request);
SOAPMessage response = connection.call(request, endpoint);
// View the output
System.out.println("\nXML Response\n");
// Create Transformer
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf = tff.newTransformer();
// Get reply content
Source sc = response.getSOAPPart().getContent();
System.out.println("SOAP Body" + response.getSOAPBody());
// Set output transformation
StreamResult result = new StreamResult(System.out);
tf.transform(sc, result);
System.out.println();
// Close connection
connection.close();
System.out.println("\nResponse =\n" + response);
catch (Exception e)
e.printStackTrace();
Pl. reply as soon as possible
Thanks in advance -
Error deserializing arguments, xml tag without a recognized type
I am trying to run a webservice created using Weblogic Workshop 8.1sp2 that communicates
with an ejb control. When I test in debug mode, I get the above error, specifically:
<detail>
<jwErr:jwErrorDetail xmlns:jwErr="http://www.bea.com/2002/04/jwErrorDetail/">
com.bea.wlw.runtime.core.request.RequestValidationException: Error deserializing
arguments.
Encountered an xml tag without a recognized type: the type must be declared with
an xsi:type attribute.
Caused by: com.bea.xml.marshal.XmlEncodingException: Encountered an xml tag with
out a recognized type: the type must be declared with an xsi:type attribute.
</detail>
I am passing a Request object to the jws method (to the ejb) that has a Collection
as an instance member. This Collection references objects of another type, Param
(code for both objects below). Before passing the object, I convert the Collection
to an array of objects. When I call the operation via a java client, I get the
above message.
In Workshop, I've included the Request and Param classes as the parameter xml
and the soap style is rpc. I've tested the ejb by itself and it is working fine.
Request.java:
import java.util.*;
public class Request implements java.io.Serializable
protected Collection params=null;
public Collection getParams()
{ return params; }
public void setParams(Collection data)
{ params=data; }
Param.java:
public class Param implements java.io.Serializable
private String name=null;
private Object value=null;
public String getName()
{ return name; }
public void setName(String data)
{ name = data; }
public Object getValue()
{ return value; }
public void setValue(Object data)
{ value=data; }
Here's the code from the jws:
public class MyWS implements com.bea.jws.WebService
* @common:control
private control.PSEjbControl psEJB;
static final long serialVersionUID = 1L;
* @common:operation
* @jws:parameter-xml
* include-java-types="mypackage.Request mypackage.Param"
* @jws:protocol soap-style="rpc"
public void addData(mypackage.Request arg0) throws java.rmi.RemoteException
System.out.println("arg0 : " + arg0);
psEJB.addData(arg0);
*Note: in the server console, arg0 comes through as null when called from my client.
Here's the bit from my client:
import weblogic.jws.proxies.*;
import org.openuri.www.encodedTypes.Request;
import org.openuri.www.encodedTypes.Param;
public void go(String wsdl) throws Exception {
MyWSSoap mw = null;
mw = new MyWS_Impl().getMyWSSoap();
Request req = new Request();
Collection reqColl = new ArrayList();
Param param1 = new Param();
param1.setName("NAME");
param1.setValue("Joe Tester");
Param param2 = new Param();
param2.setName("ADDRESS");
param2.setValue("345 Test Drive");
reqColl.add(param1);
reqColl.add(param2);
Object[] obs = reqColl.toArray();
req.setParams(obs);
mw.addData(req);
Not sure if this enough to go by. Please let me know if you need more information.
Any help is really appreciated. Thanks.Hi Keith,
My only suggestion is to factor out the java.util.Collection (see the
docs here [1]) with either primitive types or XMLBeans [2].
Sorry, not much help. You might also ask your question in the workshop
[3] newsgroup.
Bruce
[1]
http://e-docs.bea.com/workshop/docs81/doc/en/integration/reference/refJavaClassConversion.html
[2]
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/xmlbeans/conXMLBeansSupportBuiltInSchemaTypes.html
[3]
http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.workshop
Keith wrote:
>
Hi Bruce, thanks for the reply. I set the operation for document-style soap and
still get the deserialization exception as mentioned in my original note. Below
is the wsdl. Note: in my original note, the problematic operation was addData()
which is now named addBusinessLocation(). As always, your help is greatly appreciated.
Keith
<?xml version="1.0" encoding="utf-8"?>
<!-- @editor-info:link autogen="true" source="PublicServiceWS.jws" -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/"
xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://www.openuri.org/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:ope="http://www.openuri.org/">
<s:element name="addBusinessLocation">
<s:complexType>
<s:sequence>
<s:element name="arg0" type="ope:Request" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="addBusinessLocationResponse">
<s:complexType>
<s:sequence/>
</s:complexType>
</s:element>
<s:element name="getBusinessLocation">
<s:complexType>
<s:sequence/>
</s:complexType>
</s:element>
<s:element name="getBusinessLocationResponse">
<s:complexType>
<s:sequence>
<s:element name="getBusinessLocationResult" type="ope:Response" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Response" nillable="true" type="ope:Response"/>
<s:element name="repeat">
<s:complexType>
<s:sequence>
<s:element name="in" type="s:string" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="repeatResponse">
<s:complexType>
<s:sequence>
<s:element name="repeatResult" type="s:string" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="string" nillable="true" type="s:string"/>
<s:complexType name="Request">
<s:sequence>
<s:element name="Params" type="ope:Collection" minOccurs="0"/>
</s:sequence>
</s:complexType>
<s:complexType name="Collection">
<s:sequence>
<s:element name="item" type="s:anyType" nillable="true" minOccurs="0"
maxOccurs="unbounded"/>
</s:sequence>
</s:complexType>
<s:complexType name="Param">
<s:sequence>
<s:element name="Name" type="s:string" minOccurs="0"/>
<s:element name="Value" type="s:anyType" minOccurs="0"/>
</s:sequence>
</s:complexType>
<s:complexType name="Response">
<s:complexContent>
<s:extension base="ope:Request">
<s:sequence/>
</s:extension>
</s:complexContent>
</s:complexType>
</s:schema>
</types>
<message name="addBusinessLocationSoapIn">
<part name="parameters" element="s0:addBusinessLocation"/>
</message>
<message name="addBusinessLocationSoapOut">
<part name="parameters" element="s0:addBusinessLocationResponse"/>
</message>
<message name="getBusinessLocationSoapIn">
<part name="parameters" element="s0:getBusinessLocation"/>
</message>
<message name="getBusinessLocationSoapOut">
<part name="parameters" element="s0:getBusinessLocationResponse"/>
</message>
<message name="repeatSoapIn">
<part name="parameters" element="s0:repeat"/>
</message>
<message name="repeatSoapOut">
<part name="parameters" element="s0:repeatResponse"/>
</message>
<message name="getBusinessLocationHttpGetIn"/>
<message name="getBusinessLocationHttpGetOut">
<part name="Body" element="s0:Response"/>
</message>
<message name="repeatHttpGetIn">
<part name="in" type="s:string"/>
</message>
<message name="repeatHttpGetOut">
<part name="Body" element="s0:string"/>
</message>
<message name="getBusinessLocationHttpPostIn"/>
<message name="getBusinessLocationHttpPostOut">
<part name="Body" element="s0:Response"/>
</message>
<message name="repeatHttpPostIn">
<part name="in" type="s:string"/>
</message>
<message name="repeatHttpPostOut">
<part name="Body" element="s0:string"/>
</message>
<portType name="PublicServiceWSSoap">
<operation name="addBusinessLocation">
<input message="s0:addBusinessLocationSoapIn"/>
<output message="s0:addBusinessLocationSoapOut"/>
</operation>
<operation name="getBusinessLocation">
<input message="s0:getBusinessLocationSoapIn"/>
<output message="s0:getBusinessLocationSoapOut"/>
</operation>
<operation name="repeat">
<input message="s0:repeatSoapIn"/>
<output message="s0:repeatSoapOut"/>
</operation>
</portType>
<portType name="PublicServiceWSHttpGet">
<operation name="getBusinessLocation">
<input message="s0:getBusinessLocationHttpGetIn"/>
<output message="s0:getBusinessLocationHttpGetOut"/>
</operation>
<operation name="repeat">
<input message="s0:repeatHttpGetIn"/>
<output message="s0:repeatHttpGetOut"/>
</operation>
</portType>
<portType name="PublicServiceWSHttpPost">
<operation name="getBusinessLocation">
<input message="s0:getBusinessLocationHttpPostIn"/>
<output message="s0:getBusinessLocationHttpPostOut"/>
</operation>
<operation name="repeat">
<input message="s0:repeatHttpPostIn"/>
<output message="s0:repeatHttpPostOut"/>
</operation>
</portType>
<binding name="PublicServiceWSSoap" type="s0:PublicServiceWSSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="addBusinessLocation">
<soap:operation soapAction="http://www.openuri.org/addBusinessLocation"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="getBusinessLocation">
<soap:operation soapAction="http://www.openuri.org/getBusinessLocation"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="repeat">
<soap:operation soapAction="http://www.openuri.org/repeat" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<binding name="PublicServiceWSHttpGet" type="s0:PublicServiceWSHttpGet">
<http:binding verb="GET"/>
<operation name="getBusinessLocation">
<http:operation location="/getBusinessLocation"/>
<input>
<http:urlEncoded/>
</input>
<output>
<mime:mimeXml part="Body"/>
</output>
</operation>
<operation name="repeat">
<http:operation location="/repeat"/>
<input>
<http:urlEncoded/>
</input>
<output>
<mime:mimeXml part="Body"/>
</output>
</operation>
</binding>
<binding name="PublicServiceWSHttpPost" type="s0:PublicServiceWSHttpPost">
<http:binding verb="POST"/>
<operation name="getBusinessLocation">
<http:operation location="/getBusinessLocation"/>
<input>
<mime:content type="application/x-www-form-urlencoded"/>
</input>
<output>
<mime:mimeXml part="Body"/>
</output>
</operation>
<operation name="repeat">
<http:operation location="/repeat"/>
<input>
<mime:content type="application/x-www-form-urlencoded"/>
</input>
<output>
<mime:mimeXml part="Body"/>
</output>
</operation>
</binding>
<service name="PublicServiceWS">
<port name="PublicServiceWSSoap" binding="s0:PublicServiceWSSoap">
<soap:address location="http://localhost:8010/WebService/PublicServiceWS.jws"/>
</port>
<port name="PublicServiceWSHttpGet" binding="s0:PublicServiceWSHttpGet">
<http:address location="http://localhost:8010/WebService/PublicServiceWS.jws"/>
</port>
<port name="PublicServiceWSHttpPost" binding="s0:PublicServiceWSHttpPost">
<http:address location="http://localhost:8010/WebService/PublicServiceWS.jws"/>
</port>
</service>
</definitions>
Bruce Stephens <[email protected]> wrote:
Hi Keith,
As a quick test, you might try changing the protocol style to use
doc/lit (@jws:protocol soap-style="document") to see if this provides
another view on the real issue.
Could you post the generated WSDL?
Thanks,
Bruce
Keith wrote:
I am trying to run a webservice created using Weblogic Workshop 8.1sp2that communicates
with an ejb control. When I test in debug mode, I get the above error,specifically:
<detail>
<jwErr:jwErrorDetail xmlns:jwErr="http://www.bea.com/2002/04/jwErrorDetail/">
com.bea.wlw.runtime.core.request.RequestValidationException: Errordeserializing
arguments.
Encountered an xml tag without a recognized type: the type must bedeclared with
an xsi:type attribute.
Caused by: com.bea.xml.marshal.XmlEncodingException: Encountered anxml tag with
out a recognized type: the type must be declared with an xsi:type attribute.
</detail>
I am passing a Request object to the jws method (to the ejb) that hasa Collection
as an instance member. This Collection references objects of anothertype, Param
(code for both objects below). Before passing the object, I convertthe Collection
to an array of objects. When I call the operation via a java client,I get the
above message.
In Workshop, I've included the Request and Param classes as the parameterxml
and the soap style is rpc. I've tested the ejb by itself and it isworking fine.
Request.java:
import java.util.*;
public class Request implements java.io.Serializable
protected Collection params=null;
public Collection getParams()
{ return params; }
public void setParams(Collection data)
{ params=data; }
Param.java:
public class Param implements java.io.Serializable
private String name=null;
private Object value=null;
public String getName()
{ return name; }
public void setName(String data)
{ name = data; }
public Object getValue()
{ return value; }
public void setValue(Object data)
{ value=data; }
Here's the code from the jws:
public class MyWS implements com.bea.jws.WebService
* @common:control
private control.PSEjbControl psEJB;
static final long serialVersionUID = 1L;
* @common:operation
* @jws:parameter-xml
* include-java-types="mypackage.Request mypackage.Param"
* @jws:protocol soap-style="rpc"
public void addData(mypackage.Request arg0) throws java.rmi.RemoteException
System.out.println("arg0 : " + arg0);
psEJB.addData(arg0);
*Note: in the server console, arg0 comes through as null when calledfrom my client.
Here's the bit from my client:
import weblogic.jws.proxies.*;
import org.openuri.www.encodedTypes.Request;
import org.openuri.www.encodedTypes.Param;
public void go(String wsdl) throws Exception {
MyWSSoap mw = null;
mw = new MyWS_Impl().getMyWSSoap();
Request req = new Request();
Collection reqColl = new ArrayList();
Param param1 = new Param();
param1.setName("NAME");
param1.setValue("Joe Tester");
Param param2 = new Param();
param2.setName("ADDRESS");
param2.setValue("345 Test Drive");
reqColl.add(param1);
reqColl.add(param2);
Object[] obs = reqColl.toArray();
req.setParams(obs);
mw.addData(req);
Not sure if this enough to go by. Please let me know if you need moreinformation.
Any help is really appreciated. Thanks. -
I have an image that is tagged with an XML tag. I want to change the image with a script. If I change image manually the href in my XML changes, if I change the href the image doesn't.
I've managed to get a return that the image excists, but if I try to do something with it, I get invalid object error.
Any suggestions?
cheershi larsthoren,
can you elaborate more? 'coz i got an xml with the right path of image and when i load it to indesign it works fine. no need for a script.
thanks,
Kratos -
Create xml tag dynamically within simple transformation
Hi all together,
I'm faceing the following problem:
There is a internal table provided, consisting of name/value-pairs. Something like
ls_struc-name = 'NAME1'.
ls_struc-value = 'XYZ'.
append ls_struc to lt_struc
ls_struc-name = 'CITY1'.
ls_struc-value = 'Munich'.
append ls_struc to lt_struc
and so on.
I have to create this XML (with simple transformation):
<NAME1>XYZ</NAME1>
<CITY1>Munich</CITY1>
Everythings works fine so far (tables, values etc.), but I have problems with creating the XML-Tag, e.g <NAME1> from "$line.name" within the transformation. I don't have any information about the data structure (therefore "call transaction id" does not work).
Any hint is useful!!!
Best regards,
ThomasExaple program for creating XML file from abap
REPORT z_xit_xml_dom_create.
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
DATA: l_element_flights TYPE REF TO if_ixml_element,
l_element_airline TYPE REF TO if_ixml_element,
l_element_flight TYPE REF TO if_ixml_element,
l_element_from TYPE REF TO if_ixml_element,
l_element_to TYPE REF TO if_ixml_element,
l_element_dummy TYPE REF TO if_ixml_element,
l_value TYPE string.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
DATA: lt_spfli TYPE TABLE OF spfli.
DATA: l_spfli TYPE spfli.
START-OF-SELECTION.
* Fill the internal table
SELECT * FROM spfli INTO TABLE lt_spfli.
* Sort internal table
SORT lt_spfli BY carrid.
* Start filling xml dom object from internal table
LOOP AT lt_spfli INTO l_spfli.
AT FIRST.
* Creating a ixml factory
l_ixml = cl_ixml=>create( ).
* Creating the dom object model
l_document = l_ixml->create_document( ).
* Fill root node with value flights
l_element_flights = l_document->create_simple_element(
name = 'flights'
parent = l_document ).
ENDAT.
AT NEW carrid.
* Create element 'airline' as child of 'flights'
l_element_airline = l_document->create_simple_element(
name = 'airline'
parent = l_element_flights ).
* Create attribute 'code' of node 'airline'
l_value = l_spfli-carrid.
l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
* Create attribute 'name' of node 'airline'
SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
ENDAT.
AT NEW connid.
* Create element 'flight' as child of 'airline'
l_element_flight = l_document->create_simple_element(
name = 'flight'
parent = l_element_airline ).
* Create attribute 'number' of node 'flight'
l_value = l_spfli-connid.
l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
ENDAT.
* Create element 'from' as child of 'flight'
CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
l_element_from = l_document->create_simple_element(
name = 'from'
value = l_value
parent = l_element_flight ).
* Create attribute 'airport' of node 'from'
l_value = l_spfli-airpfrom.
l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
* Create element 'to' as child of 'flight'
CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
l_element_to = l_document->create_simple_element(
name = 'to'
value = l_value
parent = l_element_flight ).
* Create attribute 'airport' of node 'from'
l_value = l_spfli-airpto.
l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
* Create element 'departure' as child of 'flight'
l_value = l_spfli-deptime.
l_element_dummy = l_document->create_simple_element(
name = 'departure'
value = l_value
parent = l_element_flight ).
* Create element 'arrival' as child of 'flight'
l_value = l_spfli-arrtime.
l_element_dummy = l_document->create_simple_element(
name = 'arrival'
value = l_value
parent = l_element_flight ).
* Create element 'type' as child of 'flight'
CASE l_spfli-fltype.
WHEN 'X'.
l_value = 'Charter'.
WHEN OTHERS.
l_value = 'Scheduled'.
ENDCASE.
l_element_dummy = l_document->create_simple_element(
name = 'type'
value = l_value
parent = l_element_flight ).
ENDLOOP.
IF sy-subrc NE 0.
MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
ENDIF.
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
* Connect internal XML table to stream factory
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
* Rendering the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
* Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\temp\flights.xml'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Maybe you are looking for
-
Impossible to create or refresh webi report. (WIJ 77778) - please help
Hello, i'm experiencing problem with BO Edge Standard edition on RHEL4 trying to create or refresh a report on Webi. I have installed BO without problem on the RHEL4. I can log on Infoview and in CMC with "administrator" however when i try to create
-
Hi ! My safari browser is blocked with the Ukash virus. And I can't select Safari > Preferences > Security. I'm also unable to reinitialize Safari. What should I do ?
-
Mail, not picking up the thread in "reply'
Weird one. Sometimes mail wont pick up the thread, sometimes it will. (Intermittent problem). Current settings: Format is Rich Text Responding: Use the same message format as the original message Quote the text of the original message When Quoting te
-
Help with choosing the correct adapter
Hi, could anyone help please. I have a 20inch Cinema display that I would like to connect to an imac at work. Am i correct in thinking that all I need is the mini DVI to DVI adapter. I'm a little confused. Thanks John
-
What are the SEO implications of personalization/teasers?
It seems like the AJAX loading of personalized content would be potentially a problem for SEO. Are there any best practices around this? The client is using v5.4 but looking at upgrading to 5.6 - are there any changes in the newest versions that woul