• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Web service invokation problem

Explorer ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

Hi,
I am having problem when consuming .net web service. This web service expects xmlobject which I create using <cfxml> tag. I have used <cfinvoke> and CreateObject without any success.
First I get following error message: java.lang.IllegalArgumentException: argument type mismatch
After I refresh few times (15 or so) I get following error message: java.lang.IllegalArgumentException: java.lang.ClassCastException@1645559. I am not sure wher is the problem.

Thanks,
Mark
TOPICS
Advanced techniques

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 09, 2008 Jul 09, 2008
Just realized we've been thrashing around for nothing. There are as yet no universal standards for passing XML as arguments to Web service methods. Coldfusion has its own, as do .NET and Java.

The common currency among all web services is SOAP. Hence, one universal way of passing XML, from any client to a web service on any platform, is as a SOAP document.

In your case, you would construct a SOAP document which includes your XML. You could then pass it to the web service using <cfhttp>. I goog...

Votes

Translate

Translate
Advisor ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

Can you post the WSDL and your code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

What do you think the phrase, "argument type mismatch" means?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

My method placeOrder is expecting complex datatype. There is a placeOrderString method that i tested succesfully which accepts a xml document as a string

I am supplying xml document above with sample data and it is working with placeOrderString method using Get Http request.
When using placeOrder and supplying same xmldocument created using <cfxml> it fails.
Why there is a differnt error message after i refresh the page numerous times?

Thanks for any help
Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied


Here is my code;
<cfxml variable="xmlobject">
<cfoutput>
<Orders xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns="" Version="1.0" xsi:noNamespaceSchemaLocation="Order.xsd">
<Order>
<Customer_Data>
<SkipDupCheck>N</SkipDupCheck>
<UserId>public</UserId>
<SkipAddressCheck>Y</SkipAddressCheck>
<ChainNbr />
<StoreNbr />
<SansNbr />
<CustNbr />
<BillTo>23423</BillTo>
<ShipTo>43242</ShipTo>
<MacAcct />
<ZipStateCountry />
<ShortName />
<OneTimeShipInfo>
<Name>Joe Test</Name>
<Addr1>11 Test Ave</Addr1>
<Addr2>Town Hall</Addr2>
<Addr3 />
<City>Bethlehem</City>
<State>NY</State>
<ZipPostalCode>112222323</ZipPostalCode>
<CountryCode>US</CountryCode>
</OneTimeShipInfo>
<BillToOnly>N</BillToOnly>
</Customer_Data>
<CreditCardInfo>
<CardNbr />
<ExpDate />
<AreaCode />
<PhoneNbr />
<Contact />
<Trigger />
</CreditCardInfo>
<Deliver_Option>
<ShipVia />
<FreightTrm />
<ArriveBy />
<DeliverOn />
<NotBefore />
<ShipOn />
<FreightAmt />
<HandlingFee />
</Deliver_Option>
<SpecialInstructions>
<AuthAppearance />
<SpecInstr1 />
<SpecInstr2 />
<SpecInstrComments1 />
<SpecInstrComments2 />
<SpecInstrComments3 />
</SpecialInstructions>
<ReceiptDate />
<OrderSource>DC</OrderSource>
<OrderType>NC</OrderType>
<RushCode>N</RushCode>
<MarkFor>test</MarkFor>
<CartonRound />
<BatchNbr />
<PrintOption />
<StatusOverride />
<WarehouseCode />
<Royalty />
<Facility />
<SalesHurt />
<BarCodeNumber />
<AddSource />
<Voucher />
<TaxClassOver />
<InvoiceRoute />
<BOShipDate />
<NotToExceed />
<PrintBindOrderNumber />
<ShipWOFlag />
<WorkOrderNumber />
<CancelDate />
<CancelDays />
<AdditionalDiscount />
<Promotion />
<CustomerPurchaseOrder>312321</CustomerPurchaseOrder>
<OvrdDisc />
<DatingCode />
<OvrNetPrice />
<AccountDiscountClassOvrd />
<BOPref />
<NYPPref />
<BSBPref />
<InvoiceCombinationPref />
<LineItems>
<LineItem>
<ItemNumber>1</ItemNumber>
<Qty>1</Qty>
<AltTitleCode />
<ISBN>1234567890</ISBN>
<PromoKey />
<NetPrice />
<Discount />
<FreightTerms />
<TitleStatusOvrd>AS</TitleStatusOvrd>
<SubstituteOvrd />
<TransportOvrd />
<BackOrderCanOvrd />
</LineItem>
</LineItems>
</Order>
</Orders>
</cfoutput>
</cfxml>
<cfset ws_obj = CreateObject("webservice", " http://host/webservices/orderentry/orderentry.asmx?WSDL")>
<cfdump var="#ws_obj#">
<cfset ws_ret_ = ws_obj.placeOrder(#xmlobject#)>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

An XML document object created by <cfxml> is particularly a Coldfusion object. Chances are, it is unknown to .NET. What happens when you invoke the service using XML as text instead?



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

When I supply a string I get following error:
coldfusion.xml.rpc.ServiceProxy$ServiceMethodNotFoundException: Web service operation "placeOrder" with parameters

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

Here is a code _placeOrder.java generated using wsdl2java.exe utility:

/**
* _PlaceOrder.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/

package com.domain.services;

public class _PlaceOrder implements java.io.Serializable {
private com.domain.services._PlaceOrder_orderData orderData;

public _PlaceOrder() {
}

public com.domain.services._PlaceOrder_orderData getOrderData() {
return orderData;
}

public void setOrderData(com.domain.services._PlaceOrder_orderData orderData) {
this.orderData = orderData;
}

private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof _PlaceOrder)) return false;
_PlaceOrder other = (_PlaceOrder) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.orderData==null && other.getOrderData()==null) ||
(this.orderData!=null &&
this.orderData.equals(other.getOrderData())));
__equalsCalc = null;
return _equals;
}

private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getOrderData() != null) {
_hashCode += getOrderData().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}

// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(_PlaceOrder.class);

static {
typeDesc.setXmlType(new javax.xml.namespace.QName(" http://services.domain.com/", ">PlaceOrder"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("orderData");
elemField.setXmlName(new javax.xml.namespace.QName(" http://services.domain.com/", "orderData"));
elemField.setXmlType(new javax.xml.namespace.QName(" http://services.domain.com/", ">PlaceOrder>orderData"));
elemField.setMinOccurs(0);
typeDesc.addFieldDesc(elemField);
}

/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}

/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}

/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}

}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2008 Jul 09, 2008

Copy link to clipboard

Copied

> When I supply a string I get following error

What happens when you do something along these lines:

<cfsavecontent variable="xmlString"><?xml version="1.0" encoding="UTF-8" ?>
<Orders>
<Order>
...
etc. etc.
...
</Order>
</Orders>
</cfsavecontent>

<cfset ws_obj = CreateObject("webservice", " http://host/webservices/orderentry/orderentry.asmx?WSDL")>
<cfset ws_ret_ = ws_obj.placeOrder(xmlString)>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 09, 2008 Jul 09, 2008

Copy link to clipboard

Copied

When I use <cfsavecontent variable="xmlobject"><?xml version="1.0" encoding="UTF-8" ?>
as suggested above i get following error:
Web service operation "placeOrder" with parameters { N public Y 23423 43242 Joe Test 11 Test Ave Town Hall Bethlehem NY 112222323 US N DC NC N} could not be found.

When i supply xmldocument generated by <cfxml> i get argument type mismatch. are there complex data types that can not be represented using cf structures, arrays etc.?
Is it possible that this web service I can consume only using .net?

Any help would be appreciated
Here is a part of the wsdl that defines placeOrder:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2008 Jul 09, 2008

Copy link to clipboard

Copied

Just realized we've been thrashing around for nothing. There are as yet no universal standards for passing XML as arguments to Web service methods. Coldfusion has its own, as do .NET and Java.

The common currency among all web services is SOAP. Hence, one universal way of passing XML, from any client to a web service on any platform, is as a SOAP document.

In your case, you would construct a SOAP document which includes your XML. You could then pass it to the web service using <cfhttp>. I googled and found a fully worked out example in houseOfFusion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 10, 2008 Jul 10, 2008

Copy link to clipboard

Copied

Thanks so much BKBK for your help, after following your suggestions I was able to consume this web service using <cfhttp> method.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2008 Jul 10, 2008

Copy link to clipboard

Copied

LATEST
I'm glad to hear.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation