Best way to handle Interface Return Type for Web Service Method

Hi All,
i have the followinig situation. I would like to create a method as a web service:
Customer getCustomer(someType){....}
ie: getCustomer method, with a parameter that indicates some backend data source. The method returns a Customer object. However, depending on the datasource this method uses (which is dependent on the type passed in, ie FooDB, BarDB etc) then i return either a:
FooCustomer extends AbstractCustomer implements Customer
BarCustomer extends AbstractCustomer implements Customer
Now this fails because JAXB cant handle interfaces because when sending XML over the wire it needs a concrete representation (as far as i understand).
So how should i deal with this?
Do I need to create a differnet method for each datasource (foo DB, bar DB), ie:
FooCustomer getFooCustomer()
BarCustomer getBarCustomer()
or do i continue calling getCustomer but somehow indicate in the WSDL that I have an AbstractCustomer object and some other bits from FooCusotmer or BarCustomer or ....
kinda stumpeed here? I wouldve thought itd be handy to be able to do this (ie: call one getCustomer() method and get back Customer objects representing nay type of customer ... in some way...but cant see how to achieve this.
Any pointers would be greatly appreciated
cheers
Marty

Try to explore abstract schema type.

Similar Messages

  • Complex Return types from web service

    Hi,
    Iam developing a web service using axis.In that i want to return array of objects to the client.
    But when iam calling from the client side iam getting the class cast exception.
    I wrote server-config.wsdd file manually. do i need to add any more if i want to return array of java beans.
    server-config.wsdd
    <service name="MyService" provider="java:RPC">
        <requestFlow>
          <handler type="soapmonitor"/>
        </requestFlow>
        <responseFlow>
          <handler type="soapmonitor"/>
        </responseFlow>
           <parameter name="allowedMethods" value="*"/>
           <parameter name="className" value="com.a.b.c.X.Y.ServiceDelegate"/>
    <beanMapping qname="myNS:ABCVo"
      xmlns:myNS="com.a.b.c.vo"
      languageSpecificType="java:com.a.b.c.vo.ABCVo"/>
    </service>
    ServiceDelegate:
    public ABCVo[] getCount(String accessType,long orgId,Date fromDate,Date toDate)
              return ABCVo[];          
    client:
    I place all the stubs in the client app as a jar file. and the code is just like
    ABCVo[] so     =     del.getCount("group",l,calendar,calendar);
    Iam getting the following exception:
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.ClassCastException: [Ljava.lang.Object;
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname:evoke12
    java.lang.ClassCastException: [Ljava.lang.Object;
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
    .java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
    java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ
    ationContext.java:1087)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
    nt(AbstractSAXParser.java:633)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scan
    EndElement(XMLNSDocumentScannerImpl.java:719)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
    l$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
    l.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
    ML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
    ML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
    java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
    stractSAXParser.java:1242)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:133)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:153)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
    at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
    Context.java:227)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnders
    tandChecker.java:62)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.cscinfo.webservice.client.LmsServiceSoapBindingStub.getSOPCountBy
    NatureOfCase(Unknown Source)
    at com.cscinfo.cscglobal.web.action.EnterCSCGlobalAction.execute(EnterCS
    CGlobalAction.java:68)
    at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
    tProcessor.java:421)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:226)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
    4)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
    (StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
    tyHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:283)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
    va:42)
    at com.cj.trim.trimFilter.doFilter(Unknown Source)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
    va:42)
    at weblogicx.servlet.gzip.filter.GZIPFilter.doFilter(GZIPFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
    va:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:3229)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
    ervletContext.java:2002)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
    ontext.java:1908)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
    ava:1362)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

    It is working for me. See the following configuration.
    <service name="TestService" provider="java:RPC">
         <requestFlow>
              <handler type="soapmonitor"/>
         </requestFlow>
         <responseFlow>
              <handler type="soapmonitor"/>
         </responseFlow>
              <parameter name="allowedMethods" value="*"/>
              <parameter name="className" value="com.xxx.xxx.web.servlet.TestService"/>
              <beanMapping qname="ns:XBeanInfo" xmlns:ns="XBeanInfo" languageSpecificType="java:com.xxx.xxx.web.util.XBeanInfo"/>
         <typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
         encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
              qname="myNS:XBeanInfo"
         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
              xmlns:myNS="urn:TestService"
              type="java:com.xxx.xxx.web.util.XBeanInfo"/>
    </service>

  • How to know return type in Web service

    {color:#0000ff}I am writing a web service client application. After invoking the service it gets the result as SOAP massage. But i need to know the return type also. How can i do that?
    {color}
    here is the response obtained from web service after invoking a subtract method, it is giving correct value but doesn't give tye of value.
    <ns:SubtractResponse xmlns:ns="http://example.ws"><ns:return>81</ns:return></ns:SubtractResponse>

    View WSDL(Web Service Description Language) file of the web service. Normally WSDL file of any web service can be referenced by appending "wsdl" at the end of web service URL. e.g. http://www.abs.com/mywebservice/invokewebservice?wsdl
    Shazzad wrote:
    After invoking the service it gets the result as SOAP massage. But i need to know the return type also. How can i do that?WSDL file for a web service contains all information regarding the web service like types, message, portType, binding, service etc. Types section have schema definitions of all messages which are being used in web service. here you can find everything about all elements, fields for all the messages in the WebService including type of the values.
    You can find more about WSDL on Sun and Google very easily.
    Hope this will help.
    Thanks,
    Tejas

  • Best Way to Expose our JAVA API as web service

    we have develop an API and now, we want these API available as web services. the API abstracts the developer from database connection and the developer has to only concern himself of the object model. our problem with this API is that if we distribute this to our co-developers, their applications will be connecting directly to our database. but if we have this as a webservice, the connections to the databse will be isolated between the host that's running the webservice and the database.
    what's the best way to move these API/objects to webservices? what are our options?
    thanks,

    You can pretty much put anything you want into a web service. But remember they are designed for network/internet calls so it might make sense to bulk wrap your API calls. Due to the large amount of XML that is required by a web service if your API is large and you will have many webservices you probably want to get a tool that can generate this for you.

  • Custom data types for Web Service services

    Instead of language primitives (int, double) or Strings, is it possible to define custom data types (i.e. classes) for use in a service method argument or as a service return type? For example, if I create a class called MyClass then could I use it as an argument n a service as follows: someServiceMethod( MyClass myClassInstance). A service returning the custom type might look like this: MyClass getTheClassServiceMethod(String someString). Are either of these ideas possible?

    Hi there,
    you can use your own classes as service method argument or return type. But you should not forget to do a type mapping on both the service and client side.
    I can tell you, how I am sending and receiving my own datatype called "FileBean" which is a simple JavaBean with getter() and setter() methods for the properties.
    I'm using axis for deployment and tomcat as the web server, where my service runs on (currently only local but in future this will be remote).
    Service class: "InstallationService.java"
    Bean class: "FileBean.java"
    Client class: "FileSaving.java"
    My deploy.wsdd file has the following entry:
    <beanMapping qname="myNS:FileBean"
      xmlns:myNS="http://packageDelarationBackwards"
      languageSpecificType="java:packageDeclaration.FileBean"/>
    ...The method header in my service:
    public FileBean storeAttachments(FileBean file)The important part of my Client:
    QName qnFileBean = new QName("http://packageDelcarationBackwards", "FileBean");
    call = (Call) service.createCall();
    call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
    call.setOperationName(new QName("InstallationService","storeAttachments"));
    call.setReturnType(qnFileBean);
    call.registerTypeMapping(
                            FileBean.class,
                            qnFileBean,
                            new BeanSerializerFactory(FileBean.class, qnFileBean),
                            new BeanDeserializerFactory(FileBean.class, qnFileBean));
    ....After deploying the service and starting the server I can send my "FileBean", work with it and give it back.
    Hope this helped. If you need more information, just let me know.
    Steffi

  • PDR/Repl.Workbench, Handle 2 Message Types for Materials

    Hi there, here in an existing landscape material data gets distributed to a couple of systems with the PDR tool. A custom message type ZMATMAS2 is being used and in UPSC01 the object type MAT is mapped to that ZMATMAS2. Now, I need to connect a new system with PDR and I would like to a new message type, say ZMATMAS_NEW. (to be independen from existing extensions, segment reductions etc.)
    What would be the best way to handle different message types for different systems in PDR / UPS?
    I thought of creating a new object type in UPSC01, e.g. ZZMAT and mapping it to my ZMATMAS_NEW. But I wouldn't know how to enhance what in the consequence of that, so that PDR / UPS works with two object types for materials.
    Any idea?
    Regards,
    Karsten

    Hello Karsten.
    that is no problem - that is what the solution was designed for.
    You have to define different UPS package types and register them recipient dependant.
    kind regards
    Marcus Wagler

  • Best Way to Handle IOException in ServerSocket

    What is the best way to handle IOException thrown by ServerSocket's accept() method?

    Catch it?
    Seriously, it depends what it is. If it's a SocketTimeoutException it's up to you what to do, it's your timeout. If it's some other kind of SocketException or IOException, most probably the socket is dead and all you can do is close it.

  • Multiple Interfaces on a single web service URL

    we have a scenario where we have a multiple interfaces that are related to SD that needs to be exposed to another system. When we generate the WSDL from XI - it seems we can do only for one interface at a time.
    Is there a way - where in we can expose a single URL and treat these interfaces as web methods on that single URL? (similar to .Net or Java)
    If yes - how do we do that?
    Thanks.

    That will not be possible. Instead you have to expose only one interface which takes generic data as input. In the mapping, depending on dat, you should map them to various other interfaces which would definetly make your scenario complex..
    In XI each outbound interface is a separate web service (method).
    VJ

  • Best way to handle text files in OD10g

    We have a requirement to store reports in text format into a database field, to be able to view the reports, and to print them if desired using Forms 10g. What is the best way to handle this?
    - define the field in the database as clob or blob?
    - if CLOB is the choice, what tools to use to upload CLOBs to the database (since webutil transfer is for blob only)?
    - in Forms 10g, can one use the Forms data type LONG for CLOB?
    - can you do Forms search on clob and blob fields?
    - how can reports that are stored in fields be viewed without first downloading to the client workstation?
    - in Forms 10g, what is the best way to view text files residing in local PCs: "host notepad myFile"?
    Thanks much for your reply!
    gk

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • Best way to handle all erros and get performance(OCI)?

    Hi there,
    Im using[b] Oracle Call Interface to execute batch file process. But I have got a problem.
    I set ExecuteBatch with the same number of commit time, i.e: 100, 1000 or just 10, for thats ok.
    ((OraclePreparedStatement)globalStmt).setExecuteBatch(commit);
    And I handle executeUpdate to catch all SQL Exceptions. I made some proposital files with invalid erros but when I handle "executeUpdate" it�s doesn�t get the corrent error line, and puts out another line that is corret.
    ((OraclePreparedStatement)globalStmt).executeUpdate();
    Check in the code I concluded that its always get the same sequence of commit number like the error line. For example, I have between line 1 - 50 a line error, this line is 31, but I set the commit time for 50, its show me that line errror is 50 wherever 31. But if I put setExecuteBatch with '1' so it can handle corret lines erros, but the system performance bring down. What is the best way to handle all erros and keep the perfronace?
    Sorry for my english, I am not native. Thanks all.

    So by doing this, everything will transfer and look exactly the way I have it on the old machine?
    That is correct, if your old machine is Intel based after using MA the new machine will look just like the old machine. Here is information from Apple on MA, I'd recommend looking it over.
    My recommendation is to answer NO when setting up the new machine when it asks "Are you moving from another Mac?" The reason being let you new machine get set up and run for a couple of hours to ensure it's fine. Then launch MA and follow the prompts, it's very easy and if you use a fast connection like FW it should go smoothly.
    Regards,
    Roger

  • Best way to handle source files

    Hi there,
    After some pretty general advise please.
    The company I work for looks after a lot of websites, and one
    of the
    headaches we have is the best way to handle source files. By
    source files I'm
    referring to Photoshop files, Flash .fla files and also other
    none Adobe
    files that relate to a site, not the .html, .asp, .aspx,
    .css, .js etc type
    files.
    Now I'm NOT after a version control system, just a simple way
    to store the
    source files in a location that is separate from the website
    but still to be
    able to have a smooth workflow between the Dreamweaver site
    and it's source
    files.
    At the moment, and I know this is unwise, we have a
    subdirectory within the
    site where we store the source files, and use WebDAV to
    transfer both site
    and source files to and from the server. But I really want to
    separate the
    site from source but still maintain a link between site and
    source...... if
    you see what I mean. I think the upshot is I would like to be
    able to open a
    site within Dreamweaver and instantly be able to access that
    sites source
    files if needed. This method needs to be shared across a
    small team spread
    round the UK.
    I looked at the Repository Subversion version control, but
    like I said I'm
    not after a source control system, plus it appeared to
    conflict with WebDAV
    and Contribute, that some of our clients use to maintain
    content on their
    sites. I also looked at Version Cue which looked promising,
    but can't see a
    clear workflow between Dreamweaver and Version Cue which
    separates site from
    source. I might be missing something.... part of my brain
    perhaps. :)
    Would be grateful for any advice please.
    Cheers,
    @ndyB

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • Best way to handle inversion of custom fields?

    We've added some additional numeric fields, such as quantities, to some of the LO extractors.
    What is the best way to handle the reversal of these additional fields when reversal records come over on the extractor?  I tried switching on the "inversion" switch in the extractor and this didn't work - found OSS note 382779 which explains that this is expected behavior, that one must put some logic in the user exit to do the inversion.
    Is it just a matter of coding if the ROCANCEL field (mapped to 0STORNO in BW) is 'X' or 'R' to flip the sign of the numeric field we added?  But is it better to put this in the R/3 user exit or in a start routine in the transfer rules do you think?  Does flipping on the "inversion" switch make any difference at all in this case?
    Thanks for your help!
    Chris

    Hey,
       I dont this inversion which matters  as you said you added quantity type of fields. If i were you i will do the user exit which can take care good but tranfer routine also helps in most of the cases.

  • (workflow question) - What is the best way to handle audio in a large Premiere project?

    Hey all,
    This might probably be suitable for any version of Premiere, but just in case, I use CS4 (Master Collection)
    I am wrestling in my brain about the best way to handle audio in my project to cut down on the time I am working on it.
    This project I just finished was a 10 minute video for a customer shot on miniDV (HVX-200) cut down from 3 hours of tape.
    I edited my whole project down to what looked good, and then I decided I needed to clean up all the Audio using Soundbooth, So I had to go in clip by clip, using the Edit in SoundBooth --> Render and Replace method on every clip. I couldn't find a way to batch edit any audio in Soundbooth.
    For every clip, I performed similar actions---
    1) both tracks of audio were recorded with 2 different microphones (2 mono tracks), so I needed only audio from 1 track - I used SB to cut and paste the good track over the other track.
    2) amplified the audio
    3) cleaned up the background noise with the noise filter
    I am sure there has to be a better workflow option than what I just did (going clip by clip), Can someone give me some advice on how best to handle audio in a situation like this?
    Should I have just rendered out new audio for the whole tape I was using, and then edit from that?
    Should I have rendered out the audio after I edited the clips into one long track and performed the actions I needed on it? or something entirely different? It was a very slow, tedious process.
    Thanks,
    Aza

    Hi, Aza.
    Given that my background is audio and I'm just coming into the brave new world of visual bits and bytes, I would second Hunt's recommendation regarding exporting the entire video's audio as one wav file, working on it, and then reimporting. I do this as one of the last stages, when I know I have the editing done, with an ear towards consistency from beginning to end.
    One of the benefits of this approach is that you can manage all audio in the same context. For example, if you want to normalize, compress or limit your audio, doing it a clip at a time will make it difficult for you to match levels consistently or find a compression setting that works smoothly across the board. It's likely that there will instead be subtle or obvious differences between each clip you worked on.
    When all your audio is in one file you can, for instance, look at the entire wave form, see that limiting to -6 db would trim off most of the unnecessary peaks, triim it down, and then normalize it all. You may still have to do some tweaking here and there, but it gets you much farther down the road, much more easily.Same goes for reverb, EQ or other effects where you want the same feel throughout the entire video.
    Hope this helps,
    Chris

  • Complex return type for operations in Application Services

    Hi all,
    I am trying to create a complex return type for one of operation in CAF Application service.I have created a complex dataStructure  named productList and added product bussiness object as its attribute with cardinality 0--n. And used product dataType as my return type.
    But I am not getting any output but its work fine with cardinality 0--1.
    I am using CE 7.1 SP5 trial version.......
    Can anyone

    Hi,
    And used product dataType as my return type.
    Are you sure you did not forgot to change you operations return type to "productList"?
    Best regards
    Philipp

  • Best way to handle when Production XI is in outrage/down

    Hi All,
    My production box is running smoothly now.If we want to go for any outrage and still we will be receiving many messages through internet from many partners.
    So we are expecting how to receive the messages when production XI is in outrage. My client is thinking of putting one more instance with the replica of Production box. So that when the main production is in outrage then immediately they can switch back to this replica version and they can process the messages untill the main one get ready.
    Now I am very much concern what are the implication will be if we go like this.
    1. which is the best way to handle XI box to maintain when the system is outrage/down?
    2. Is it a good idea of creating replica of production instance and maintaing this when the main one is in outrage?
    Kindly suggest what you guys are doing for your implementations.
    Thanks
    Seema

    >
    > 1. which is the best way to handle XI box to maintain when the system is outrage/down?(An act of extreme violence or viciousness)
    >
    XI Box - Outrage -Should be a robotic XI Box. Now I know that you are thinking what to do when cops come and handcuff it. -- Just kidding..
    Ok, here's the logic, you want to replace a piece of water pipe that gets water to your faucet. What do you do without the water leaking or disrupting the water supply... you either turn off the valve or add a temp pipe to keep the water flowing..
    So check into your sys landscape for Fail safe or High Availability, may be one of those can save you money and time.
    AB

Maybe you are looking for