|
|
|
date: Fri, 17 Feb 2006 14:32:35 +0000,
group: microsoft.public.data.xmlanalysis
back
Connecting to Analysis Services with Java XML
I know this has been posted before but I cannot seem to find an answer to
my problem. Basically I am having trouble with the connection string in
"DataSourceInfo". I get the error:
XA:XMLAnalysisError.88BA0500
Unable to process the request, because the DataSourceInfo property was
missing or not correctly specified
I can get the VB sample to work no problem but for some reason I just
cannot get Java to work. I know I should not be using hard-coded
parameters but I am just trying to get it to work and they are the same I
am using in the VB example.
My Java code is:
import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*; import
org.apache.soap.util.xml.*;
import org.apache.soap.transport.http.*;
public class Client {
public static void main( String[] args ) throws Exception {
URL url = new URL("http://192.168.2.106/xmla/msxisapi.dll";
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("","Result"), null, null, sd);
SOAPHTTPConnection st = new SOAPHTTPConnection();
Call call = new Call();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI
("urn:schemas-microsoft-com:xml-analysis");
call.setMethodName("Discover");
call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
Vector params = new Vector();
params.addElement(new Parameter("RequestType",String.class,
"MDSCHEMA_CUBES", null));
params.addElement(new Parameter("Restrictions",String.class,
"<RestrictionList>" +
"<DataSourceName>" +
"Local Analysis Server" +
"</DataSourceName>" +
"<CATALOG_NAME>" +
"FoodMart" +
"</CATALOG_NAME>" +
"</RestrictionList>", null ));
params.addElement(new Parameter("Properties",String.class,
"<PropertyList>" +
"<DataSourceInfo>" +
"Data Source=server1;Provider=MSOLAP.2" +
"</DataSourceInfo>" +
"<Catalog>" +
"Foodmart" +
"</Catalog>" +
"</PropertyList>", null ));
call.setParams(params);
call.buildEnvelope();
System.out.println("Request="+call.toString()+"\n");
Response resp = null;
try {
resp = call.invoke (url,
"urn:schemas-microsoft-com:xml-analysis:Discover");
}
catch (SOAPException e) {
System.err.println("Caught SOAPException(" +
e.getFaultCode() + "): " +
e.getMessage ());
return;
}
if (resp != null && !resp.generatedFault()) {
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println("Answer="+value);
}
else {
Fault fault = resp.getFault();
System.out.println("Generated Fault:");
System.out.println("Fault code = "+fault.getFaultCode());
System.out.println("Fault string = "+fault.getFaultString());
}
}
}
Anyone any ideas?
Thanks.
date: Fri, 17 Feb 2006 14:32:35 +0000
author: DY
Re: Connecting to Analysis Services with Java XML
Most likely your <Properties> element isn't in the correct namespace.
Compare your Java request to the VB request and see the difference...
Thanks,
Akshai
--
--
This posting is provided "AS IS" with no warranties, and confers no rights
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"DY" wrote in message
news:pan.2006.02.17.14.32.34.824590@removethis.ahcis.com...
>I know this has been posted before but I cannot seem to find an answer to
> my problem. Basically I am having trouble with the connection string in
> "DataSourceInfo". I get the error:
>
> XA:XMLAnalysisError.88BA0500
> Unable to process the request, because the DataSourceInfo property was
> missing or not correctly specified
>
> I can get the VB sample to work no problem but for some reason I just
> cannot get Java to work. I know I should not be using hard-coded
> parameters but I am just trying to get it to work and they are the same I
> am using in the VB example.
>
> My Java code is:
>
> import java.net.*;
> import java.util.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
> import org.apache.soap.encoding.*;
> import org.apache.soap.encoding.soapenc.*; import
> org.apache.soap.util.xml.*;
> import org.apache.soap.transport.http.*;
>
> public class Client {
>
> public static void main( String[] args ) throws Exception {
>
> URL url = new URL("http://192.168.2.106/xmla/msxisapi.dll";
>
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
> StringDeserializer sd = new StringDeserializer();
> smr.mapTypes(Constants.NS_URI_SOAP_ENC,
> new QName("","Result"), null, null, sd);
>
> SOAPHTTPConnection st = new SOAPHTTPConnection();
>
> Call call = new Call();
> call.setSOAPTransport(st);
> call.setSOAPMappingRegistry(smr);
>
> call.setTargetObjectURI
> ("urn:schemas-microsoft-com:xml-analysis");
> call.setMethodName("Discover");
>
> call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
>
> Vector params = new Vector();
>
> params.addElement(new Parameter("RequestType",String.class,
> "MDSCHEMA_CUBES", null));
>
> params.addElement(new Parameter("Restrictions",String.class,
> "<RestrictionList>" +
> "<DataSourceName>" +
> "Local Analysis Server" +
> "</DataSourceName>" +
>
> "<CATALOG_NAME>" +
> "FoodMart" +
> "</CATALOG_NAME>" +
> "</RestrictionList>", null ));
>
> params.addElement(new Parameter("Properties",String.class,
> "<PropertyList>" +
> "<DataSourceInfo>" +
> "Data Source=server1;Provider=MSOLAP.2" +
> "</DataSourceInfo>" +
>
> "<Catalog>" +
> "Foodmart" +
> "</Catalog>" +
> "</PropertyList>", null ));
>
>
> call.setParams(params);
> call.buildEnvelope();
>
> System.out.println("Request="+call.toString()+"\n");
>
> Response resp = null;
> try {
> resp = call.invoke (url,
> "urn:schemas-microsoft-com:xml-analysis:Discover");
> }
> catch (SOAPException e) {
> System.err.println("Caught SOAPException(" +
> e.getFaultCode() + "): " +
> e.getMessage ());
> return;
> }
>
> if (resp != null && !resp.generatedFault()) {
> Parameter ret = resp.getReturnValue();
> Object value = ret.getValue();
>
> System.out.println("Answer="+value);
> }
> else {
> Fault fault = resp.getFault();
> System.out.println("Generated Fault:");
> System.out.println("Fault code = "+fault.getFaultCode());
> System.out.println("Fault string = "+fault.getFaultString());
> }
> }
> }
>
> Anyone any ideas?
>
> Thanks.
date: Fri, 17 Feb 2006 11:34:30 -0800
author: Akshai Mirchandani [MS]
Re: Connecting to Analysis Services with Java XML
Thanks for the reply but sadly no luck. I am actually a bit confused by
the various tags so I would be very grateful if you can confirm I have
done the right thing as follows:
I have changed datasource.xml to have the following entries and changed
the VB program to the same and it still works, so I know the changes are
OK.
datasources.xml:
....
<DataSourceName>XYZ</DataSourceName>
....
<DataSourceInfo>Provider=MSOLAP.2;Data Source=serversql</DataSourceInfo>
....
In the VB code, the relevent line seems to be:
m_strProperties = "<DataSourceInfo>" & DATASOURCE & "</DataSourceInfo>" _
....
so I changed:
Const DATASOURCE = "XYZ"
When I run the program, it reports that DataSourceName is XYZ
and DataSourceInfo is also XYZ. ???? (I am confused here)
So I have plugged the same values into my Java program but it still gives
the error. I have now got:
params.addElement(new Parameter("Restrictions",String.class,
"<RestrictionList>" +
"<DataSourceName>" +
"XYZ" +
"</DataSourceName>" +
"<CATALOG_NAME>" +
"FoodMart" +
"</CATALOG_NAME>" +
"</RestrictionList>", null ));
params.addElement(new Parameter("Properties",String.class,
"<PropertyList>" +
"<DataSourceInfo>" +
"XYZ" +
"</DataSourceInfo>" +
"<Catalog>" +
"Foodmart" +
"</Catalog>" +
"</PropertyList>", null ));
I have also tried just changing <DataSourceName> to XYZ and leaving
<DataSourceInfo> as Provider=MSOLAP.2;Data Source=serversql but no luck.
Have I missed something? Is there a way of looking at the request stream
to IIS (another problem: there is no facility for looking at the IIS log
for some reason. I am no Windows expert so perhaps someone can tell me how
to do this and where does IIS keep the log file?? - Windows 2000)
Many thanks.
On Fri, 17 Feb 2006 11:34:30 -0800, Akshai Mirchandani [MS] wrote:
> Most likely your <Properties> element isn't in the correct namespace.
> Compare your Java request to the VB request and see the difference...
>
> Thanks,
> Akshai
>
> --
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
> Please do not send email directly to this alias. This alias is for newsgroup
> purposes only.
>
>
> "DY" wrote in message
> news:pan.2006.02.17.14.32.34.824590@removethis.ahcis.com...
>>I know this has been posted before but I cannot seem to find an answer to
>> my problem. Basically I am having trouble with the connection string in
>> "DataSourceInfo". I get the error:
>>
>> XA:XMLAnalysisError.88BA0500
>> Unable to process the request, because the DataSourceInfo property was
>> missing or not correctly specified
>>
>> I can get the VB sample to work no problem but for some reason I just
>> cannot get Java to work. I know I should not be using hard-coded
>> parameters but I am just trying to get it to work and they are the same I
>> am using in the VB example.
>>
>> My Java code is:
>>
>> import java.net.*;
>> import java.util.*;
>> import org.apache.soap.*;
>> import org.apache.soap.rpc.*;
>> import org.apache.soap.encoding.*;
>> import org.apache.soap.encoding.soapenc.*; import
>> org.apache.soap.util.xml.*;
>> import org.apache.soap.transport.http.*;
>>
>> public class Client {
>>
>> public static void main( String[] args ) throws Exception {
>>
>> URL url = new URL("http://192.168.2.106/xmla/msxisapi.dll";
>>
>> SOAPMappingRegistry smr = new SOAPMappingRegistry();
>> StringDeserializer sd = new StringDeserializer();
>> smr.mapTypes(Constants.NS_URI_SOAP_ENC,
>> new QName("","Result"), null, null, sd);
>>
>> SOAPHTTPConnection st = new SOAPHTTPConnection();
>>
>> Call call = new Call();
>> call.setSOAPTransport(st);
>> call.setSOAPMappingRegistry(smr);
>>
>> call.setTargetObjectURI
>> ("urn:schemas-microsoft-com:xml-analysis");
>> call.setMethodName("Discover");
>>
>> call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
>>
>> Vector params = new Vector();
>>
>> params.addElement(new Parameter("RequestType",String.class,
>> "MDSCHEMA_CUBES", null));
>>
>> params.addElement(new Parameter("Restrictions",String.class,
>> "<RestrictionList>" +
>> "<DataSourceName>" +
>> "Local Analysis Server" +
>> "</DataSourceName>" +
>>
>> "<CATALOG_NAME>" +
>> "FoodMart" +
>> "</CATALOG_NAME>" +
>> "</RestrictionList>", null ));
>>
>> params.addElement(new Parameter("Properties",String.class,
>> "<PropertyList>" +
>> "<DataSourceInfo>" +
>> "Data Source=server1;Provider=MSOLAP.2" +
>> "</DataSourceInfo>" +
>>
>> "<Catalog>" +
>> "Foodmart" +
>> "</Catalog>" +
>> "</PropertyList>", null ));
>>
>>
>> call.setParams(params);
>> call.buildEnvelope();
>>
>> System.out.println("Request="+call.toString()+"\n");
>>
>> Response resp = null;
>> try {
>> resp = call.invoke (url,
>> "urn:schemas-microsoft-com:xml-analysis:Discover");
>> }
>> catch (SOAPException e) {
>> System.err.println("Caught SOAPException(" +
>> e.getFaultCode() + "): " +
>> e.getMessage ());
>> return;
>> }
>>
>> if (resp != null && !resp.generatedFault()) {
>> Parameter ret = resp.getReturnValue();
>> Object value = ret.getValue();
>>
>> System.out.println("Answer="+value);
>> }
>> else {
>> Fault fault = resp.getFault();
>> System.out.println("Generated Fault:");
>> System.out.println("Fault code = "+fault.getFaultCode());
>> System.out.println("Fault string = "+fault.getFaultString());
>> }
>> }
>> }
>>
>> Anyone any ideas?
>>
>> Thanks.
date: Mon, 20 Feb 2006 12:48:40 +0000
author: DY
Re: Connecting to Analysis Services with Java XML
I said to change the "namespace" and not the content (you may also need to
change the content but that wasn't your initial problem). The namespace is
something like this:
<Properties xmlns="urn:schemas-microsoft-com:xml-analysis">
<PropertyList>
...
</Properties>
The xmlns specifies a namespace (sort of like a Java package). You need to
make sure that the element you add to your request has the correct
namespace.
Thanks,
Akshai
--
--
This posting is provided "AS IS" with no warranties, and confers no rights
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"DY" wrote in message
news:pan.2006.02.20.12.48.36.565938@removethis.ahcis.com...
> Thanks for the reply but sadly no luck. I am actually a bit confused by
> the various tags so I would be very grateful if you can confirm I have
> done the right thing as follows:
>
> I have changed datasource.xml to have the following entries and changed
> the VB program to the same and it still works, so I know the changes are
> OK.
>
> datasources.xml:
> ...
> <DataSourceName>XYZ</DataSourceName>
> ...
> <DataSourceInfo>Provider=MSOLAP.2;Data Source=serversql</DataSourceInfo>
> ...
>
> In the VB code, the relevent line seems to be:
> m_strProperties = "<DataSourceInfo>" & DATASOURCE & "</DataSourceInfo>" _
> ...
> so I changed:
> Const DATASOURCE = "XYZ"
>
> When I run the program, it reports that DataSourceName is XYZ
> and DataSourceInfo is also XYZ. ???? (I am confused here)
>
> So I have plugged the same values into my Java program but it still gives
> the error. I have now got:
>
> params.addElement(new Parameter("Restrictions",String.class,
> "<RestrictionList>" +
> "<DataSourceName>" +
> "XYZ" +
> "</DataSourceName>" +
>
> "<CATALOG_NAME>" +
> "FoodMart" +
> "</CATALOG_NAME>" +
> "</RestrictionList>", null ));
>
> params.addElement(new Parameter("Properties",String.class,
> "<PropertyList>" +
> "<DataSourceInfo>" +
> "XYZ" +
> "</DataSourceInfo>" +
>
> "<Catalog>" +
> "Foodmart" +
> "</Catalog>" +
> "</PropertyList>", null ));
>
> I have also tried just changing <DataSourceName> to XYZ and leaving
> <DataSourceInfo> as Provider=MSOLAP.2;Data Source=serversql but no luck.
>
> Have I missed something? Is there a way of looking at the request stream
> to IIS (another problem: there is no facility for looking at the IIS log
> for some reason. I am no Windows expert so perhaps someone can tell me how
> to do this and where does IIS keep the log file?? - Windows 2000)
>
> Many thanks.
>
>
>
>
> On Fri, 17 Feb 2006 11:34:30 -0800, Akshai Mirchandani [MS] wrote:
>
>> Most likely your <Properties> element isn't in the correct namespace.
>> Compare your Java request to the VB request and see the difference...
>>
>> Thanks,
>> Akshai
>>
>> --
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights
>> Please do not send email directly to this alias. This alias is for
>> newsgroup
>> purposes only.
>>
>>
>> "DY" wrote in message
>> news:pan.2006.02.17.14.32.34.824590@removethis.ahcis.com...
>>>I know this has been posted before but I cannot seem to find an answer to
>>> my problem. Basically I am having trouble with the connection string in
>>> "DataSourceInfo". I get the error:
>>>
>>> XA:XMLAnalysisError.88BA0500
>>> Unable to process the request, because the DataSourceInfo property was
>>> missing or not correctly specified
>>>
>>> I can get the VB sample to work no problem but for some reason I just
>>> cannot get Java to work. I know I should not be using hard-coded
>>> parameters but I am just trying to get it to work and they are the same
>>> I
>>> am using in the VB example.
>>>
>>> My Java code is:
>>>
>>> import java.net.*;
>>> import java.util.*;
>>> import org.apache.soap.*;
>>> import org.apache.soap.rpc.*;
>>> import org.apache.soap.encoding.*;
>>> import org.apache.soap.encoding.soapenc.*; import
>>> org.apache.soap.util.xml.*;
>>> import org.apache.soap.transport.http.*;
>>>
>>> public class Client {
>>>
>>> public static void main( String[] args ) throws Exception {
>>>
>>> URL url = new URL("http://192.168.2.106/xmla/msxisapi.dll";
>>>
>>> SOAPMappingRegistry smr = new SOAPMappingRegistry();
>>> StringDeserializer sd = new StringDeserializer();
>>> smr.mapTypes(Constants.NS_URI_SOAP_ENC,
>>> new QName("","Result"), null, null, sd);
>>>
>>> SOAPHTTPConnection st = new SOAPHTTPConnection();
>>>
>>> Call call = new Call();
>>> call.setSOAPTransport(st);
>>> call.setSOAPMappingRegistry(smr);
>>>
>>> call.setTargetObjectURI
>>> ("urn:schemas-microsoft-com:xml-analysis");
>>> call.setMethodName("Discover");
>>>
>>> call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
>>>
>>> Vector params = new Vector();
>>>
>>> params.addElement(new Parameter("RequestType",String.class,
>>> "MDSCHEMA_CUBES", null));
>>>
>>> params.addElement(new Parameter("Restrictions",String.class,
>>> "<RestrictionList>" +
>>> "<DataSourceName>" +
>>> "Local Analysis Server" +
>>> "</DataSourceName>" +
>>>
>>> "<CATALOG_NAME>" +
>>> "FoodMart" +
>>> "</CATALOG_NAME>" +
>>> "</RestrictionList>", null ));
>>>
>>> params.addElement(new Parameter("Properties",String.class,
>>> "<PropertyList>" +
>>> "<DataSourceInfo>" +
>>> "Data Source=server1;Provider=MSOLAP.2" +
>>> "</DataSourceInfo>" +
>>>
>>> "<Catalog>" +
>>> "Foodmart" +
>>> "</Catalog>" +
>>> "</PropertyList>", null ));
>>>
>>>
>>> call.setParams(params);
>>> call.buildEnvelope();
>>>
>>> System.out.println("Request="+call.toString()+"\n");
>>>
>>> Response resp = null;
>>> try {
>>> resp = call.invoke (url,
>>> "urn:schemas-microsoft-com:xml-analysis:Discover");
>>> }
>>> catch (SOAPException e) {
>>> System.err.println("Caught SOAPException(" +
>>> e.getFaultCode() + "): " +
>>> e.getMessage ());
>>> return;
>>> }
>>>
>>> if (resp != null && !resp.generatedFault()) {
>>> Parameter ret = resp.getReturnValue();
>>> Object value = ret.getValue();
>>>
>>> System.out.println("Answer="+value);
>>> }
>>> else {
>>> Fault fault = resp.getFault();
>>> System.out.println("Generated Fault:");
>>> System.out.println("Fault code = "+fault.getFaultCode());
>>> System.out.println("Fault string = "+fault.getFaultString());
>>> }
>>> }
>>> }
>>>
>>> Anyone any ideas?
>>>
>>> Thanks.
>
date: Mon, 20 Feb 2006 10:57:03 -0800
author: Akshai Mirchandani [MS]
|
|